Merge pull request #660 from MichaelRFairhurst/SDK_AT_HEAD-dont-extend-error-verifier2

Use `LocalElementBuilder` so that `FunctionExpression`s analyze.
diff --git a/angular_analyzer_plugin/lib/src/resolver.dart b/angular_analyzer_plugin/lib/src/resolver.dart
index bdcd056..0c42200 100644
--- a/angular_analyzer_plugin/lib/src/resolver.dart
+++ b/angular_analyzer_plugin/lib/src/resolver.dart
@@ -7,6 +7,7 @@
 import 'package:analyzer/dart/element/type.dart';
 import 'package:analyzer/error/error.dart';
 import 'package:analyzer/error/listener.dart';
+import 'package:analyzer/src/dart/element/builder.dart';
 import 'package:analyzer/src/dart/element/element.dart';
 import 'package:analyzer/src/dart/element/inheritance_manager2.dart';
 import 'package:analyzer/src/error/codes.dart';
@@ -32,25 +33,6 @@
   return parent is ElementInfo && parent.tagMatchedAsCustomTag;
 }
 
-/// Overrides standard [ErrorVerifier] to prevent issues with analyzing dangling
-/// angular nodes. Not intended as a long-term solution.
-class AngularErrorVerifier extends ErrorVerifier {
-  AngularErrorVerifier(
-      ErrorReporter errorReporter,
-      LibraryElement currentLibrary,
-      TypeProvider typeProvider,
-      InheritanceManager2 inheritanceManager,
-      {@required bool enableSuperMixins})
-      : super(errorReporter, currentLibrary, typeProvider, inheritanceManager,
-            enableSuperMixins);
-
-  @override
-  void visitFunctionExpression(FunctionExpression func) {
-    // Stop resolving or analyzer will crash.
-    // TODO(mfairhurst): fix the analyzer crash and remove this.
-  }
-}
-
 /// Overrides standard [ResolverVisitor] to prevent issues with analyzing
 /// dangling angular nodes, while also allowing custom resolution of pipes. Not
 /// intended as a long-term solution.
@@ -96,12 +78,6 @@
       }
     }
   }
-
-  @override
-  void visitFunctionExpression(FunctionExpression func) {
-    // Stop resolving or analyzer will crash.
-    // TODO(mfairhurst): fix the analyzer crash and remove this.
-  }
 }
 
 /// Probably the most important visitor to understand in how we process angular
@@ -1650,6 +1626,10 @@
     final classElement = view.classElement;
     final library = classElement.library;
     {
+      final visitor = new LocalElementBuilder.forDanglingExpression();
+      astNode.accept(visitor);
+    }
+    {
       final visitor = new TypeResolverVisitor(
           library, view.source, typeProvider, errorListener);
       astNode.accept(visitor);
@@ -1670,9 +1650,8 @@
     // do resolve
     astNode.accept(resolver);
     // verify
-    final verifier = new AngularErrorVerifier(
-        errorReporter, library, typeProvider, inheritanceManager2,
-        enableSuperMixins: true)
+    final verifier = new ErrorVerifier(
+        errorReporter, library, typeProvider, inheritanceManager2, true)
       ..enclosingClass = classElement;
     astNode.accept(verifier);
     // Check for concepts illegal to templates (for instance function literals).
diff --git a/angular_analyzer_plugin/lib/src/standard_components.dart b/angular_analyzer_plugin/lib/src/standard_components.dart
index 5e5132e..85517c9 100644
--- a/angular_analyzer_plugin/lib/src/standard_components.dart
+++ b/angular_analyzer_plugin/lib/src/standard_components.dart
@@ -3,7 +3,6 @@
 import 'package:analyzer/dart/ast/visitor.dart';
 import 'package:analyzer/dart/element/element.dart';
 import 'package:analyzer/dart/element/type.dart';
-import 'package:analyzer/src/dart/analysis/driver.dart';
 import 'package:analyzer/src/generated/source.dart';
 import 'package:angular_analyzer_plugin/src/model.dart';
 import 'package:angular_analyzer_plugin/src/selector.dart';
diff --git a/angular_analyzer_plugin/test/resolver_test.dart b/angular_analyzer_plugin/test/resolver_test.dart
index c6fa8ba..16d6d60 100644
--- a/angular_analyzer_plugin/test/resolver_test.dart
+++ b/angular_analyzer_plugin/test/resolver_test.dart
@@ -2171,7 +2171,7 @@
 }
 ''');
     final code = r"""
-<h1 [hidden]="(){}"></h1>
+<h1 [hidden]="(){} == null"></h1>
 """;
     _addHtmlSource(code);
     await _resolveSingleTemplate(dartSource);
@@ -2188,12 +2188,12 @@
 }
 ''');
     final code = r"""
-<h1 [hidden]="()=>x"></h1>
+<h1 [hidden]="null == ()=>null"></h1>
 """;
     _addHtmlSource(code);
     await _resolveSingleTemplate(dartSource);
     assertErrorInCodeAtPosition(
-        AngularWarningCode.DISALLOWED_EXPRESSION, code, "()=>x");
+        AngularWarningCode.DISALLOWED_EXPRESSION, code, "()=>null");
   }
 
   // ignore: non_constant_identifier_names