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

Unified Diff: pkg/compiler/lib/src/resolution/registry.dart

Issue 1438453002: Use Feature directly in resolution. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 5 years, 1 month 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
« no previous file with comments | « pkg/compiler/lib/src/resolution/members.dart ('k') | pkg/compiler/lib/src/resolution/resolution.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/resolution/registry.dart
diff --git a/pkg/compiler/lib/src/resolution/registry.dart b/pkg/compiler/lib/src/resolution/registry.dart
index 64df6d54cdc7707ab6d9d0084904283240634517..5ef981790af0a64c8be75c564a974033f254c50e 100644
--- a/pkg/compiler/lib/src/resolution/registry.dart
+++ b/pkg/compiler/lib/src/resolution/registry.dart
@@ -50,6 +50,7 @@ class _ResolutionWorldImpact extends ResolutionImpact with WorldImpactBuilder {
Setlet<MapLiteralUse> _mapLiterals;
Setlet<ListLiteralUse> _listLiterals;
Setlet<String> _constSymbolNames;
+ Setlet<ConstantExpression> _constantLiterals;
_ResolutionWorldImpact(this.name);
@@ -106,6 +107,18 @@ class _ResolutionWorldImpact extends ResolutionImpact with WorldImpactBuilder {
return _features != null ? _features : const <Feature>[];
}
+ void registerConstantLiteral(ConstantExpression constant) {
+ if (_constantLiterals == null) {
+ _constantLiterals = new Setlet<ConstantExpression>();
+ }
+ _constantLiterals.add(constant);
+ }
+
+ Iterable<ConstantExpression> get constantLiterals {
+ return _constantLiterals != null
+ ? _constantLiterals : const <ConstantExpression>[];
+ }
+
String toString() => '_ResolutionWorldImpact($name)';
}
@@ -292,30 +305,10 @@ class ResolutionRegistry extends Registry {
worldImpact.registerStaticUse(staticUse);
}
- void registerLazyField() {
- worldImpact.registerFeature(Feature.LAZY_FIELD);
- }
-
void registerMetadataConstant(MetadataAnnotation metadata) {
backend.registerMetadataConstant(metadata, metadata.annotatedElement, this);
}
- void registerThrowRuntimeError() {
- worldImpact.registerFeature(Feature.THROW_RUNTIME_ERROR);
- }
-
- void registerCompileTimeError(ErroneousElement error) {
- worldImpact.registerFeature(Feature.COMPILE_TIME_ERROR);
- }
-
- void registerTypeVariableBoundCheck() {
- worldImpact.registerFeature(Feature.TYPE_VARIABLE_BOUNDS_CHECK);
- }
-
- void registerThrowNoSuchMethod() {
- worldImpact.registerFeature(Feature.THROW_NO_SUCH_METHOD);
- }
-
/// Register the use of a type.
void registerTypeUse(TypeUse typeUse) {
worldImpact.registerTypeUse(typeUse);
@@ -329,10 +322,6 @@ class ResolutionRegistry extends Registry {
mapping.addSuperUse(node);
}
- void registerSuperNoSuchMethod() {
- worldImpact.registerFeature(Feature.SUPER_NO_SUCH_METHOD);
- }
-
void registerTypeLiteral(Send node, DartType type) {
mapping.setType(node, type);
worldImpact.registerTypeUse(new TypeUse.typeLiteral(type));
@@ -369,36 +358,16 @@ class ResolutionRegistry extends Registry {
worldImpact.registerDynamicUse(dynamicUse);
}
- void registerConstSymbol(String name) {
- worldImpact.registerConstSymbolName(name);
- }
-
- void registerSymbolConstructor() {
- worldImpact.registerFeature(Feature.SYMBOL_CONSTRUCTOR);
- }
-
- void registerAbstractClassInstantiation() {
- worldImpact.registerFeature(Feature.ABSTRACT_CLASS_INSTANTIATION);
- }
-
- void registerStringInterpolation() {
- worldImpact.registerFeature(Feature.STRING_INTERPOLATION);
- }
-
- void registerFallThroughError() {
- worldImpact.registerFeature(Feature.FALL_THROUGH_ERROR);
- }
-
- void registerCatchStatement() {
- worldImpact.registerFeature(Feature.CATCH_STATEMENT);
+ void registerFeature(Feature feature) {
+ worldImpact.registerFeature(feature);
}
- void registerStackTraceInCatch() {
- worldImpact.registerFeature(Feature.STACK_TRACE_IN_CATCH);
+ void registerConstSymbol(String name) {
+ worldImpact.registerConstSymbolName(name);
}
- void registerSyncForIn(Node node) {
- worldImpact.registerFeature(Feature.SYNC_FOR_IN);
+ void registerConstantLiteral(ConstantExpression constant) {
+ worldImpact.registerConstantLiteral(constant);
}
ClassElement defaultSuperclass(ClassElement element) {
@@ -410,19 +379,10 @@ class ResolutionRegistry extends Registry {
universe.registerMixinUse(mixinApplication, mixin);
}
- void registerThrowExpression() {
- worldImpact.registerFeature(Feature.THROW_EXPRESSION);
- }
-
void registerInstantiation(InterfaceType type) {
worldImpact.registerTypeUse(new TypeUse.instantiation(type));
}
- void registerAssert(bool hasMessage) {
- worldImpact.registerFeature(
- hasMessage ? Feature.ASSERT_WITH_MESSAGE : Feature.ASSERT);
- }
-
void registerSendStructure(Send node, SendStructure sendStructure) {
mapping.setSendStructure(node, sendStructure);
}
@@ -433,30 +393,6 @@ class ResolutionRegistry extends Registry {
return mapping.getSendStructure(node);
}
- void registerAsyncMarker(FunctionElement element) {
- switch (element.asyncMarker) {
- case AsyncMarker.SYNC:
- break;
- case AsyncMarker.SYNC_STAR:
- worldImpact.registerFeature(Feature.SYNC_STAR);
- break;
- case AsyncMarker.ASYNC:
- worldImpact.registerFeature(Feature.ASYNC);
- break;
- case AsyncMarker.ASYNC_STAR:
- worldImpact.registerFeature(Feature.ASYNC_STAR);
- break;
- }
- }
-
- void registerAsyncForIn(AsyncForIn node) {
- worldImpact.registerFeature(Feature.ASYNC_FOR_IN);
- }
-
- void registerIncDecOperation() {
- worldImpact.registerFeature(Feature.INC_DEC_OPERATION);
- }
-
void registerTryStatement() {
mapping.containsTryStatement = true;
}
« no previous file with comments | « pkg/compiler/lib/src/resolution/members.dart ('k') | pkg/compiler/lib/src/resolution/resolution.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698