Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(709)

Unified Diff: lib/src/utils.dart

Issue 1088943006: implement tear offs (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: lib/src/utils.dart
diff --git a/lib/src/utils.dart b/lib/src/utils.dart
index 314c5fb5e0eadfbbc24aa04be6dd84c6cc3f3d54..5bafdb3db1e9dff0c50c72223955f98f6d598246 100644
--- a/lib/src/utils.dart
+++ b/lib/src/utils.dart
@@ -18,7 +18,8 @@ import 'package:analyzer/src/generated/ast.dart'
AnnotatedNode,
AstNode,
Expression,
- SimpleIdentifier;
+ SimpleIdentifier,
+ MethodInvocation;
import 'package:analyzer/src/generated/constant.dart' show DartObjectImpl;
import 'package:analyzer/src/generated/element.dart';
import 'package:analyzer/src/generated/engine.dart'
@@ -388,3 +389,11 @@ Object getConstantField(
InterfaceType fillDynamicTypeArgs(InterfaceType t, TypeProvider types) =>
t.substitute4(new List.filled(t.typeArguments.length, types.dynamicType));
+
+/// Similar to [SimpleIdentifier] inGetterContext, inSetterContext, and
+/// inDeclarationContext, this method returns true if [node] is used in an
+/// invocation context such as a MethodInvocation.
+bool inInvocationContext(SimpleIdentifier node) {
+ var parent = node.parent;
+ return parent is MethodInvocation && parent.methodName == node;
+}

Powered by Google App Engine
This is Rietveld 408576698