Index: pkg/compiler/lib/src/universe/use.dart |
diff --git a/pkg/compiler/lib/src/universe/use.dart b/pkg/compiler/lib/src/universe/use.dart |
index fad9d905e8c6fec7a4bb8f80693538449f597fc5..7cb642eae11b7f86834091035dda2d5355597c16 100644 |
--- a/pkg/compiler/lib/src/universe/use.dart |
+++ b/pkg/compiler/lib/src/universe/use.dart |
@@ -73,6 +73,7 @@ enum StaticUseKind { |
CLOSURE, |
CONSTRUCTOR_INVOKE, |
CONST_CONSTRUCTOR_INVOKE, |
+ DIRECT_INVOKE, |
} |
/// Statically known use of an [Element]. |
@@ -207,6 +208,35 @@ class StaticUse { |
return new StaticUse.internal(element, StaticUseKind.GENERAL); |
} |
+ /// Direct invocation of a method [element] with the given [callStructure]. |
+ factory StaticUse.directInvoke( |
+ MethodElement element, CallStructure callStructure) { |
+ // TODO(johnniwinther): Use the [callStructure]. |
+ assert(invariant(element, element.isInstanceMember, |
+ message: "Direct invoke element $element must be an instance member.")); |
+ assert(invariant(element, element.isFunction, |
+ message: "Direct invoke element $element must be a method.")); |
+ return new StaticUse.internal(element, StaticUseKind.DIRECT_INVOKE); |
+ } |
+ |
+ /// Direct read access of a field or getter [element]. |
+ factory StaticUse.directGet(MemberElement element) { |
+ assert(invariant(element, element.isInstanceMember, |
+ message: "Direct get element $element must be an instance member.")); |
+ assert(invariant(element, element.isField || element.isGetter, |
+ message: "Direct get element $element must be a field or a getter.")); |
+ return new StaticUse.internal(element, StaticUseKind.GENERAL); |
Siggi Cherem (dart-lang)
2016/10/18 14:45:22
shouldn't this and the one below be a DIRECT_INVOK
Johnni Winther
2016/10/19 07:45:43
No. This is only used for getters and fields which
|
+ } |
+ |
+ /// Direct write access of a field [element]. |
+ factory StaticUse.directSet(FieldElement element) { |
+ assert(invariant(element, element.isInstanceMember, |
+ message: "Direct set element $element must be an instance member.")); |
+ assert(invariant(element, element.isField, |
+ message: "Direct set element $element must be a field.")); |
+ return new StaticUse.internal(element, StaticUseKind.GENERAL); |
+ } |
+ |
/// Constructor invocation of [element] with the given [callStructure]. |
factory StaticUse.constructorInvoke( |
ConstructorElement element, CallStructure callStructure) { |