anchor.diff:    }
   
     visitField(Field node) {
  -    if (node.isConst) {
  -      // Since we convert all use-sites of constants, the constant [Field]
  -      // cannot be referenced anymore.  We therefore get rid of it if
  -      // [keepFields] was not specified.
  -      if (!keepFields) return null;
  -
  -      // Otherwise we keep the constant [Field] and convert it's initializer.
  -      if (node.initializer != null) {
  -        node.initializer =
  -            tryEvaluateAndTransformWithContext(node, node.initializer)
  -              ..parent = node;
  +    return constantEvaluator.withNewEnvironment(() {
  +      if (node.isConst) {
  +        // Since we convert all use-sites of constants, the constant [Field]
  +        // cannot be referenced anymore.  We therefore get rid of it if
  +        // [keepFields] was not specified.
  +        if (!keepFields) {
  +          return null;
  +        }
  +
  +        // Otherwise we keep the constant [Field] and convert it's initializer.
  +        transformAnnotations(node.annotations, node);
  +        if (node.initializer != null) {
  +          node.initializer =
  +              tryEvaluateAndTransformWithContext(node, node.initializer)
  +                ..parent = node;
  +        }
  +      } else {
  +        transformAnnotations(node.annotations, node);
  +        if (node.initializer != null) {
  +          node.initializer = node.initializer.accept(this)..parent = node;
  +        }
         }
         return node;
  -    }
  -    return super.visitField(node);
  +    });
     }
   
     // Handle use-sites of constants (and "inline" constant expressions):
  
positive.code:       backend,
        keepFields,
        keepVariables,
        coreTypes,
        typeEnvironment,
        strongMode,
        enableAsserts,
        errorReporter);
    for (final Library library in libraries) {
      constantsTransformer.convertLibraryAnnotations(library);
  
      for (final Field field in library.fields.toList()) {
        constantsTransformer.convertField(field);
      }
      for (final Procedure procedure in library.procedures) {
        constantsTransformer.convertProcedure(procedure);
      }
      for (final Class klass in library.classes) {
        constantsTransformer.convertClassAnnotations(klass);
  
        for (final Field field in klass.fields.toList()) {
          constantsTransformer.convertField(field);
        }
        for (final Procedure procedure in klass.procedures) {
          constantsTransformer.convertProcedure(procedure);
        }
        for (final Constructor constructor in klass.constructors) {
          constantsTransformer.convertConstructor(constructor);
        }
      }
      for (final Typedef td in library.typedefs) {
        constantsTransformer.convertTypedef(td);
      }
  
      if (!keepFields) {
        // The transformer API does not iterate over `Library.additionalExports`,
        // so we manually delete the references to shaken nodes.
        library.additionalExports.removeWhere((Reference reference) {
          return reference.canonicalName == null;
        });
      }
    }
  }
  
  
negative.code:   /// Whether to preserve constant [Field]s.  All use-sites will be rewritten.
    final bool keepFields;
    final bool keepVariables;
    final bool evaluateAnnotations;
  
    ConstantsTransformer(
        ConstantsBackend backend,
        this.keepFields,
        this.keepVariables,
        this.evaluateAnnotations,
        this.coreTypes,
        this.typeEnvironment,
        bool strongMode,
  