| Index: lib/src/compiler/element_helpers.dart
|
| diff --git a/lib/src/compiler/element_helpers.dart b/lib/src/compiler/element_helpers.dart
|
| index dc8ff6cb93a769ceaaecda88cc6751b1d650b371..a5d95d8328dab6388df1344b0c2b8f490ddd0f64 100644
|
| --- a/lib/src/compiler/element_helpers.dart
|
| +++ b/lib/src/compiler/element_helpers.dart
|
| @@ -5,9 +5,16 @@
|
| /// Helpers for Analyzer's Element model and corelib model.
|
|
|
| import 'package:analyzer/dart/ast/ast.dart'
|
| - show Expression, MethodInvocation, SimpleIdentifier;
|
| + show
|
| + ConstructorDeclaration,
|
| + Expression,
|
| + FunctionBody,
|
| + FunctionExpression,
|
| + MethodDeclaration,
|
| + MethodInvocation,
|
| + SimpleIdentifier;
|
| import 'package:analyzer/dart/element/element.dart'
|
| - show Element, FunctionElement;
|
| + show Element, ExecutableElement, FunctionElement;
|
| import 'package:analyzer/dart/element/type.dart'
|
| show DartType, InterfaceType, ParameterizedType;
|
| import 'package:analyzer/src/dart/element/type.dart' show DynamicTypeImpl;
|
| @@ -82,6 +89,17 @@ bool isInlineJS(Element e) =>
|
| e.library.isInSdk &&
|
| e.library.source.uri.toString() == 'dart:_foreign_helper';
|
|
|
| +ExecutableElement getFunctionBodyElement(FunctionBody body) {
|
| + var f = body.parent;
|
| + if (f is FunctionExpression) {
|
| + return f.element;
|
| + } else if (f is MethodDeclaration) {
|
| + return f.element;
|
| + } else {
|
| + return (f as ConstructorDeclaration).element;
|
| + }
|
| +}
|
| +
|
| /// Returns the value of the `name` field from the [match]ing annotation on
|
| /// [element], or `null` if we didn't find a valid match or it was not a string.
|
| ///
|
|
|