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

Unified Diff: pkg/compiler/lib/src/universe/use.dart

Issue 1809533004: Support serialization of WorldImpact (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 4 years, 9 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: 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 77c108441a4392c155323d5b3a4b3476a78673c9..73fb979741c9333b82dcafc47f0be55cf32f68fd 100644
--- a/pkg/compiler/lib/src/universe/use.dart
+++ b/pkg/compiler/lib/src/universe/use.dart
@@ -84,7 +84,7 @@ class StaticUse {
final StaticUseKind kind;
final int hashCode;
- StaticUse._(Element element, StaticUseKind kind)
+ StaticUse.internal(Element element, StaticUseKind kind)
: this.element = element,
this.kind = kind,
this.hashCode = Hashing.objectHash(element, Hashing.objectHash(kind)) {
@@ -101,7 +101,7 @@ class StaticUse {
assert(invariant(element, element.isStatic || element.isTopLevel,
message: "Static invoke element $element must be a top-level "
"or static method."));
- return new StaticUse._(element, StaticUseKind.GENERAL);
+ return new StaticUse.internal(element, StaticUseKind.GENERAL);
}
/// Closurization of a static or top-level function [element].
@@ -109,7 +109,7 @@ class StaticUse {
assert(invariant(element, element.isStatic || element.isTopLevel,
message: "Static tear-off element $element must be a top-level "
"or static method."));
- return new StaticUse._(element, StaticUseKind.STATIC_TEAR_OFF);
+ return new StaticUse.internal(element, StaticUseKind.STATIC_TEAR_OFF);
}
/// Read access of a static or top-level field or getter [element].
@@ -119,7 +119,7 @@ class StaticUse {
"or static method."));
assert(invariant(element, element.isField || element.isGetter,
message: "Static get element $element must be a field or a getter."));
- return new StaticUse._(element, StaticUseKind.GENERAL);
+ return new StaticUse.internal(element, StaticUseKind.GENERAL);
}
/// Write access of a static or top-level field or setter [element].
@@ -129,7 +129,7 @@ class StaticUse {
"or static method."));
assert(invariant(element, element.isField || element.isSetter,
message: "Static set element $element must be a field or a setter."));
- return new StaticUse._(element, StaticUseKind.GENERAL);
+ return new StaticUse.internal(element, StaticUseKind.GENERAL);
}
/// Invocation of the lazy initializer for a static or top-level field
@@ -140,7 +140,7 @@ class StaticUse {
"or static method."));
assert(invariant(element, element.isField,
message: "Static init element $element must be a field."));
- return new StaticUse._(element, StaticUseKind.GENERAL);
+ return new StaticUse.internal(element, StaticUseKind.GENERAL);
}
/// Invocation of a super method [element] with the given [callStructure].
@@ -149,7 +149,7 @@ class StaticUse {
// TODO(johnniwinther): Use the [callStructure].
assert(invariant(element, element.isInstanceMember,
message: "Super invoke element $element must be an instance method."));
- return new StaticUse._(element, StaticUseKind.GENERAL);
+ return new StaticUse.internal(element, StaticUseKind.GENERAL);
}
/// Read access of a super field or getter [element].
@@ -158,7 +158,7 @@ class StaticUse {
message: "Super get element $element must be an instance method."));
assert(invariant(element, element.isField || element.isGetter,
message: "Super get element $element must be a field or a getter."));
- return new StaticUse._(element, StaticUseKind.GENERAL);
+ return new StaticUse.internal(element, StaticUseKind.GENERAL);
}
/// Write access of a super field [element].
@@ -167,7 +167,7 @@ class StaticUse {
message: "Super set element $element must be an instance method."));
assert(invariant(element, element.isField,
message: "Super set element $element must be a field."));
- return new StaticUse._(element, StaticUseKind.SUPER_FIELD_SET);
+ return new StaticUse.internal(element, StaticUseKind.SUPER_FIELD_SET);
}
/// Write access of a super setter [element].
@@ -176,14 +176,14 @@ class StaticUse {
message: "Super set element $element must be an instance method."));
assert(invariant(element, element.isSetter,
message: "Super set element $element must be a setter."));
- return new StaticUse._(element, StaticUseKind.GENERAL);
+ return new StaticUse.internal(element, StaticUseKind.GENERAL);
}
/// Closurization of a super method [element].
factory StaticUse.superTearOff(MethodElement element) {
assert(invariant(element, element.isInstanceMember && element.isFunction,
message: "Super invoke element $element must be an instance method."));
- return new StaticUse._(element, StaticUseKind.SUPER_TEAR_OFF);
+ return new StaticUse.internal(element, StaticUseKind.SUPER_TEAR_OFF);
}
/// Invocation of a constructor [element] through a this or super
@@ -195,7 +195,7 @@ class StaticUse {
element.isGenerativeConstructor,
message: "Constructor invoke element $element must be a "
"generative constructor."));
- return new StaticUse._(element, StaticUseKind.GENERAL);
+ return new StaticUse.internal(element, StaticUseKind.GENERAL);
}
/// Invocation of a constructor (body) [element] through a this or super
@@ -203,26 +203,26 @@ class StaticUse {
factory StaticUse.constructorBodyInvoke(ConstructorBodyElement element,
CallStructure callStructure) {
// TODO(johnniwinther): Use the [callStructure].
- return new StaticUse._(element, StaticUseKind.GENERAL);
+ return new StaticUse.internal(element, StaticUseKind.GENERAL);
}
/// Constructor invocation of [element] with the given [callStructure].
factory StaticUse.constructorInvoke(ConstructorElement element,
CallStructure callStructure) {
// TODO(johnniwinther): Use the [callStructure].
- return new StaticUse._(element, StaticUseKind.GENERAL);
+ return new StaticUse.internal(element, StaticUseKind.GENERAL);
}
/// Constructor redirection to [element].
factory StaticUse.constructorRedirect(ConstructorElement element) {
- return new StaticUse._(element, StaticUseKind.GENERAL);
+ return new StaticUse.internal(element, StaticUseKind.GENERAL);
}
/// Initialization of an instance field [element].
factory StaticUse.fieldInit(FieldElement element) {
assert(invariant(element, element.isInstanceMember,
message: "Field init element $element must be an instance field."));
- return new StaticUse._(element, StaticUseKind.GENERAL);
+ return new StaticUse.internal(element, StaticUseKind.GENERAL);
}
/// Read access of an instance field or boxed field [element].
@@ -231,7 +231,7 @@ class StaticUse {
element.isInstanceMember || element is BoxFieldElement,
message: "Field init element $element must be an instance "
"or boxed field."));
- return new StaticUse._(element, StaticUseKind.FIELD_GET);
+ return new StaticUse.internal(element, StaticUseKind.FIELD_GET);
}
/// Write access of an instance field or boxed field [element].
@@ -240,18 +240,18 @@ class StaticUse {
element.isInstanceMember || element is BoxFieldElement,
message: "Field init element $element must be an instance "
"or boxed field."));
- return new StaticUse._(element, StaticUseKind.FIELD_SET);
+ return new StaticUse.internal(element, StaticUseKind.FIELD_SET);
}
/// Read of a local function [element].
factory StaticUse.closure(LocalFunctionElement element) {
- return new StaticUse._(element, StaticUseKind.CLOSURE);
+ return new StaticUse.internal(element, StaticUseKind.CLOSURE);
}
/// Unknown use of [element].
@deprecated
factory StaticUse.foreignUse(Element element) {
- return new StaticUse._(element, StaticUseKind.GENERAL);
+ return new StaticUse.internal(element, StaticUseKind.GENERAL);
}
bool operator ==(other) {
@@ -279,39 +279,39 @@ class TypeUse {
final TypeUseKind kind;
final int hashCode;
- TypeUse._(DartType type, TypeUseKind kind)
+ TypeUse.internal(DartType type, TypeUseKind kind)
: this.type = type,
this.kind = kind,
this.hashCode = Hashing.objectHash(type, Hashing.objectHash(kind));
/// [type] used in an is check, like `e is T` or `e is! T`.
factory TypeUse.isCheck(DartType type) {
- return new TypeUse._(type, TypeUseKind.IS_CHECK);
+ return new TypeUse.internal(type, TypeUseKind.IS_CHECK);
}
/// [type] used in an as cast, like `e as T`.
factory TypeUse.asCast(DartType type) {
- return new TypeUse._(type, TypeUseKind.AS_CAST);
+ return new TypeUse.internal(type, TypeUseKind.AS_CAST);
}
/// [type] used as a type annotation, like `T foo;`.
factory TypeUse.checkedModeCheck(DartType type) {
- return new TypeUse._(type, TypeUseKind.CHECKED_MODE_CHECK);
+ return new TypeUse.internal(type, TypeUseKind.CHECKED_MODE_CHECK);
}
/// [type] used in a on type catch clause, like `try {} on T catch (e) {}`.
factory TypeUse.catchType(DartType type) {
- return new TypeUse._(type, TypeUseKind.CATCH_TYPE);
+ return new TypeUse.internal(type, TypeUseKind.CATCH_TYPE);
}
/// [type] used as a type literal, like `foo() => T;`.
factory TypeUse.typeLiteral(DartType type) {
- return new TypeUse._(type, TypeUseKind.TYPE_LITERAL);
+ return new TypeUse.internal(type, TypeUseKind.TYPE_LITERAL);
}
/// [type] used in an instantiation, like `new T();`.
factory TypeUse.instantiation(InterfaceType type) {
- return new TypeUse._(type, TypeUseKind.INSTANTIATION);
+ return new TypeUse.internal(type, TypeUseKind.INSTANTIATION);
}
bool operator ==(other) {

Powered by Google App Engine
This is Rietveld 408576698