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

Unified Diff: pkg/compiler/lib/src/enqueue.dart

Issue 1422623014: Add TypeUse. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Updated cf. comments. 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/deferred_load.dart ('k') | pkg/compiler/lib/src/js_backend/backend.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/enqueue.dart
diff --git a/pkg/compiler/lib/src/enqueue.dart b/pkg/compiler/lib/src/enqueue.dart
index 89bbeda4b56983ace7a047a810fbd975d92ef060..39ec4385cefbe2da7670472c8ccf54acd43ac9a7 100644
--- a/pkg/compiler/lib/src/enqueue.dart
+++ b/pkg/compiler/lib/src/enqueue.dart
@@ -54,7 +54,9 @@ import 'universe/universe.dart';
import 'universe/use.dart' show
DynamicUse,
StaticUse,
- StaticUseKind;
+ StaticUseKind,
+ TypeUse,
+ TypeUseKind;
import 'universe/world_impact.dart' show
WorldImpact;
import 'util/util.dart' show
@@ -167,13 +169,7 @@ abstract class Enqueuer {
// TODO(johnniwinther): Optimize the application of the world impact.
worldImpact.dynamicUses.forEach(registerDynamicUse);
worldImpact.staticUses.forEach(registerStaticUse);
- worldImpact.instantiatedTypes.forEach(registerInstantiatedType);
- worldImpact.isChecks.forEach(registerIsCheck);
- worldImpact.asCasts.forEach(registerIsCheck);
- if (compiler.enableTypeAssertions) {
- worldImpact.checkedModeChecks.forEach(registerIsCheck);
- }
- worldImpact.onCatchTypes.forEach(registerIsCheck);
+ worldImpact.typeUses.forEach(registerTypeUse);
worldImpact.closures.forEach(registerClosure);
}
@@ -640,7 +636,29 @@ abstract class Enqueuer {
}
}
- void registerIsCheck(DartType type) {
+ void registerTypeUse(TypeUse typeUse) {
+ DartType type = typeUse.type;
+ switch (typeUse.kind) {
+ case TypeUseKind.INSTANTIATION:
+ registerInstantiatedType(type);
+ break;
+ case TypeUseKind.INSTANTIATION:
+ case TypeUseKind.IS_CHECK:
+ case TypeUseKind.AS_CAST:
+ case TypeUseKind.CATCH_TYPE:
+ _registerIsCheck(type);
+ break;
+ case TypeUseKind.CHECKED_MODE_CHECK:
+ if (compiler.enableTypeAssertions) {
+ _registerIsCheck(type);
+ }
+ break;
+ case TypeUseKind.TYPE_LITERAL:
+ break;
+ }
+ }
+
+ void _registerIsCheck(DartType type) {
type = universe.registerIsCheck(type, compiler);
// Even in checked mode, type annotations for return type and argument
// types do not imply type checks, so there should never be a check
« no previous file with comments | « pkg/compiler/lib/src/deferred_load.dart ('k') | pkg/compiler/lib/src/js_backend/backend.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698