anchor.diff:     * 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);
  +    _walker = new ElementWalker.forCompilationUnit(element);
       unit.element = element;
  -    unit.accept(this);
  -    _validateResolution();
  +    try {
  +      unit.accept(this);
  +      _walker.validate();
  +    } on Error catch (e, st) {
  +      throw new _ElementMismatchException(
  +          element, _walker.element, new CaughtException(e, st));
  +    }
     }
   
     @override
     Object visitCatchClause(CatchClause node) {
       SimpleIdentifier exceptionParameter = node.exceptionParameter;
       if (exceptionParameter != null) {
  -      List<LocalVariableElement> localVariables =
  -          _enclosingExecutable.localVariables;
  -      _findIdentifier(localVariables, exceptionParameter);
  +      _match(exceptionParameter, _walker.getVariable());
         SimpleIdentifier stackTraceParameter = node.stackTraceParameter;
         if (stackTraceParameter != null) {
  -        _findIdentifier(localVariables, stackTraceParameter);
  +        _match(stackTraceParameter, _walker.getVariable());
         }
       }
       return super.visitCatchClause(node);
  
positive.code: // BSD-style license that can be found in the LICENSE file.
  
  library analyzer.src.generated.declaration_resolver;
  
  import 'dart:collection';
  
  import 'package:analyzer/dart/ast/ast.dart';
  import 'package:analyzer/dart/ast/token.dart';
  import 'package:analyzer/dart/ast/visitor.dart';
  import 'package:analyzer/dart/element/element.dart';
  import 'package:analyzer/dart/element/visitor.dart';
  import 'package:analyzer/exception/exception.dart';
  import 'package:analyzer/src/dart/element/element.dart';
  
  
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);
      }
  