anchor.diff:    }
   
     /**
  -   * Throw an exception if there are non-synthetic elements in the element model
  -   * that were not associated with an AST node.
  -   */
  -  void _validateResolution() {
  -    if (_expectedElements.isNotEmpty) {
  -      StringBuffer buffer = new StringBuffer();
  -      buffer.write(_expectedElements.length);
  -      buffer.writeln(' unmatched elements found:');
  -      for (Element element in _expectedElements) {
  -        buffer.write('  ');
  -        buffer.writeln(element);
  +   * Recurses through the element model and AST, verifying that all elements are
  +   * matched.
  +   *
  +   * Executes [callback] with [_walker] pointing to the given [walker] (which
  +   * should be a new instance of [ElementWalker]).  Once [callback] returns,
  +   * uses [ElementWalker.validate] to verify that all expected elements have
  +   * been matched.
  +   */
  +  void _walk(ElementWalker walker, void callback()) {
  +    ElementWalker outerWalker = _walker;
  +    _walker = walker;
  +    callback();
  +    walker.validate();
  +    _walker = outerWalker;
  +  }
  +}
  +
  +/**
  + * Keeps track of the set of non-synthetic child elements of an element,
  + * yielding them one at a time in response to "get" method calls.
  + */
  +class ElementWalker {
  +  /**
  +   * The element whose child elements are being walked.
  +   */
  +  final Element element;
  +
  +  List<PropertyAccessorElement> _accessors;
  +  int _accessorIndex = 0;
  +  List<ClassElement> _classes;
  +  int _classIndex = 0;
  +  List<ConstructorElement> _constructors;
  +  int _constructorIndex = 0;
  +  List<ClassElement> _enums;
  +  int _enumIndex = 0;
  +  List<ExecutableElement> _functions;
  +  int _functionIndex = 0;
  +  List<LabelElement> _labels;
  +  int _labelIndex = 0;
  +  List<ParameterElement> _parameters;
  +  int _parameterIndex = 0;
  +  List<FunctionTypeAliasElement> _typedefs;
  +  int _typedefIndex = 0;
  +  List<TypeParameterElement> _typeParameters;
  +  int _typeParameterIndex = 0;
  +  List<VariableElement> _variables;
  +  int _variableIndex = 0;
  +
  +  /**
  +   * Creates an [ElementWalker] which walks the child elements of a class
  +   * element.
  +   */
  +  ElementWalker.forClass(ClassElement element)
  +      : element = element,
  +        _accessors = element.accessors.where(_isNotSynthetic).toList(),
  +        _constructors = element.isMixinApplication
  +            ? null
  +            : element.constructors.where(_isNotSynthetic).toList(),
  +        _functions = element.methods,
  +        _typeParameters = element.typeParameters,
  +        _variables = element.fields.where(_isNotSynthetic).toList();
  +
  +  /**
  +   * Creates an [ElementWalker] which walks the child elements of a compilation
  +   * unit element.
  +   */
  +  ElementWalker.forCompilationUnit(CompilationUnitElement compilationUnit)
  +      : element = compilationUnit,
  +        _accessors = compilationUnit.accessors.where(_isNotSynthetic).toList(),
  +        _classes = compilationUnit.types,
  +        _enums = compilationUnit.enums,
  +        _functions = compilationUnit.functions,
  +        _typedefs = compilationUnit.functionTypeAliases,
  +        _variables =
  +            compilationUnit.topLevelVariables.where(_isNotSynthetic).toList();
  +
  +  /**
  +   * Creates an [ElementWalker] which walks the child elements of a compilation
  +   * unit element.
  +   */
  +  ElementWalker.forExecutable(ExecutableElement element)
  +      : element = element,
  +        _functions = element.functions,
  +        _labels = element.labels,
  +        _parameters = element.parameters,
  +        _typeParameters = element.typeParameters,
  +        _variables = element.localVariables;
  +
  +  /**
  +   * Creates an [ElementWalker] which walks the child elements of a parameter
  +   * element.
  +   */
  +  ElementWalker.forParameter(ParameterElement element)
  +      : element = element,
  +        _parameters = element.parameters;
  +
  +  /**
  +   * Creates an [ElementWalker] which walks the child elements of a typedef
  +   * element.
  +   */
  +  ElementWalker.forTypedef(FunctionTypeAliasElement element)
  +      : element = element,
  +        _parameters = element.parameters,
  +        _typeParameters = element.typeParameters;
  +
  +  /**
  +   * Returns the next non-synthetic child of [element] which is an accessor;
  +   * throws an [IndexError] if there are no more.
  +   */
  +  PropertyAccessorElement getAccessor() => _accessors[_accessorIndex++];
  +
  +  /**
  +   * Returns the next non-synthetic child of [element] which is a class; throws
  +   * an [IndexError] if there are no more.
  +   */
  +  ClassElement getClass() => _classes[_classIndex++];
  +
  +  /**
  +   * Returns the next non-synthetic child of [element] which is a constructor;
  +   * throws an [IndexError] if there are no more.
  +   */
  +  ConstructorElement getConstructor() => _constructors[_constructorIndex++];
  +
  +  /**
  +   * Returns the next non-synthetic child of [element] which is an enum; throws
  +   * an [IndexError] if there are no more.
  +   */
  +  ClassElement getEnum() => _enums[_enumIndex++];
  +
  +  /**
  +   * Returns the next non-synthetic child of [element] which is a top level
  +   * function, method, or local function; throws an [IndexError] if there are no
  +   * more.
  +   */
  +  ExecutableElement getFunction() => _functions[_functionIndex++];
  +
  +  /**
  +   * Returns the next non-synthetic child of [element] which is a label; throws
  +   * an [IndexError] if there are no more.
  +   */
  +  LabelElement getLabel() => _labels[_labelIndex++];
  +
  +  /**
  +   * Returns the next non-synthetic child of [element] which is a parameter;
  +   * throws an [IndexError] if there are no more.
  +   */
  +  ParameterElement getParameter() => _parameters[_parameterIndex++];
  +
  +  /**
  +   * Returns the next non-synthetic child of [element] which is a typedef;
  +   * throws an [IndexError] if there are no more.
  +   */
  +  FunctionTypeAliasElement getTypedef() => _typedefs[_typedefIndex++];
  +
  +  /**
  +   * Returns the next non-synthetic child of [element] which is a type
  +   * parameter; throws an [IndexError] if there are no more.
  +   */
  +  TypeParameterElement getTypeParameter() =>
  +      _typeParameters[_typeParameterIndex++];
  +
  +  /**
  +   * Returns the next non-synthetic child of [element] which is a top level
  +   * variable, field, or local variable; throws an [IndexError] if there are no
  +   * more.
  +   */
  +  VariableElement getVariable() => _variables[_variableIndex++];
  +
  +  /**
  +   * Verifies that all non-synthetic children of [element] have been obtained
  +   * from their corresponding "get" method calls; if not, throws a [StateError].
  +   */
  +  void validate() {
  +    void check(List<Element> elements, int index) {
  +      if (elements != null && elements.length != index) {
  +        throw new StateError(
  +            'Unmatched ${elements[index].runtimeType} ${elements[index]}');
         }
  -      throw new _ElementMismatchException(buffer.toString());
  -    }
  -  }
  +    }
  +
  +    check(_accessors, _accessorIndex);
  +    check(_classes, _classIndex);
  +    check(_constructors, _constructorIndex);
  +    check(_enums, _enumIndex);
  +    check(_functions, _functionIndex);
  +    check(_labels, _labelIndex);
  +    check(_parameters, _parameterIndex);
  +    check(_typedefs, _typedefIndex);
  +    check(_typeParameters, _typeParameterIndex);
  +    check(_variables, _variableIndex);
  +  }
  +
  +  static bool _isNotSynthetic(Element e) => !e.isSynthetic;
   }
   
  -/**
  - * A visitor that can be used to collect all of the non-synthetic elements in an
  - * element model.
  - */
  -class _ElementGatherer extends GeneralizingElementVisitor {
  -  /**
  -   * The set in which the elements are collected.
  -   */
  -  final Set<Element> elements = new HashSet<Element>();
  -
  -  /**
  -   * Initialize the visitor.
  -   */
  -  _ElementGatherer();
  -
  -  @override
  -  void visitElement(Element element) {
  -    if (!element.isSynthetic) {
  -      elements.add(element);
  -    }
  -    super.visitElement(element);
  -  }
  +class _ElementMismatchException extends AnalysisException {
  +  /**
  +   * Creates an exception to refer to the given [compilationUnit], [element],
  +   * and [cause].
  +   */
  +  _ElementMismatchException(
  +      CompilationUnitElement compilationUnit, Element element,
  +      [CaughtException cause = null])
  +      : super('Element mismatch in $compilationUnit at $element', cause);
   }
  -
  -class _ElementMismatchException extends AnalysisException {
  -  /**
  -   * Initialize a newly created exception to have the given [message] and
  -   * [cause].
  -   */
  -  _ElementMismatchException(String message, [CaughtException cause = null])
  -      : super(message, cause);
  -}
  -
  -/**
  - * A mixin for classes that use an existing element model to resolve a portion
  - * of an AST structure.
  - */
  -class _ExistingElementResolver {
  -  /**
  -   * The compilation unit containing the AST nodes being visited.
  -   */
  -  CompilationUnitElementImpl _enclosingUnit;
  -
  -  /**
  -   * Throw an [ElementMismatchException] to report that the element model and the
  -   * AST do not match. The [message] will have the path to the given [node]
  -   * appended to it.
  -   */
  -  void _mismatch(String message, AstNode node) {
  -    StringBuffer buffer = new StringBuffer();
  -    buffer.write('Mismatch in ');
  -    buffer.write(runtimeType);
  -    buffer.write(' while resolving ');
  -    buffer.writeln(_enclosingUnit?.source?.fullName);
  -    buffer.writeln(message);
  -    buffer.write('Path to root:');
  -    String separator = ' ';
  -    AstNode parent = node;
  -    while (parent != null) {
  -      buffer.write(separator);
  -      buffer.write(parent.runtimeType.toString());
  -      separator = ', ';
  -      parent = parent.parent;
  -    }
  -    throw new _ElementMismatchException(buffer.toString());
  -  }
  -}
  
positive.code:    * if the element model and compilation unit do not match each other.
     */
    void resolve(CompilationUnit unit, CompilationUnitElement element) {
      _ElementGatherer gatherer = new _ElementGatherer();
      element.accept(gatherer);
      _expectedElements = gatherer.elements;
      _enclosingUnit = element;
      _expectedElements.remove(element);
      unit.element = element;
      unit.accept(this);
      _validateResolution();
    }
  
    @override
    Object visitCatchClause(CatchClause node) {
      SimpleIdentifier exceptionParameter = node.exceptionParameter;
      if (exceptionParameter != null) {
        List<LocalVariableElement> localVariables =
            _enclosingExecutable.localVariables;
        _findIdentifier(localVariables, exceptionParameter);
        SimpleIdentifier stackTraceParameter = node.stackTraceParameter;
        if (stackTraceParameter != null) {
          _findIdentifier(localVariables, stackTraceParameter);
        }
      }
      return super.visitCatchClause(node);
  
negative.code:   @override
    Object visitFieldFormalParameter(FieldFormalParameter node) {
      if (node.parent is! DefaultFormalParameter) {
        ParameterElement element =
            _match(node.identifier, _walker.getParameter());
        _walk(new ElementWalker.forParameter(element), () {
          super.visitFieldFormalParameter(node);
        });
        _resolveMetadata(node, node.metadata, element);
        return null;
      } else {
        return super.visitFieldFormalParameter(node);
      }
  