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

Unified Diff: sdk/lib/_internal/compiler/implementation/js_backend/backend.dart

Issue 118273004: Handle typedefs in registerRequiredType. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: */ Created 7 years 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: sdk/lib/_internal/compiler/implementation/js_backend/backend.dart
diff --git a/sdk/lib/_internal/compiler/implementation/js_backend/backend.dart b/sdk/lib/_internal/compiler/implementation/js_backend/backend.dart
index 9151b71b64d9c5716c39bb68541acdd54f0cf6f0..46f3d7401d350c13083affbab0d7500c55dcd3b7 100644
--- a/sdk/lib/_internal/compiler/implementation/js_backend/backend.dart
+++ b/sdk/lib/_internal/compiler/implementation/js_backend/backend.dart
@@ -1006,33 +1006,15 @@ class JavaScriptBackend extends Backend {
}
void registerRequiredType(DartType type, Element enclosingElement) {
- /**
- * If [argument] has type variables or is a type variable, this
- * method registers a RTI dependency between the class where the
- * type variable is defined (that is the enclosing class of the
- * current element being resolved) and the class of [annotation].
- * If the class of [annotation] requires RTI, then the class of
- * the type variable does too.
- */
- void analyzeTypeArgument(DartType annotation, DartType argument) {
- if (argument == null) return;
- if (argument.element.isTypeVariable()) {
- ClassElement enclosing = argument.element.getEnclosingClass();
- assert(enclosing == enclosingElement.getEnclosingClass().declaration);
- rti.registerRtiDependency(annotation.element, enclosing);
- } else if (argument is InterfaceType) {
- InterfaceType type = argument;
- type.typeArguments.forEach((DartType argument) {
- analyzeTypeArgument(annotation, argument);
- });
- }
- }
-
- if (type is InterfaceType) {
- InterfaceType itf = type;
- itf.typeArguments.forEach((DartType argument) {
- analyzeTypeArgument(type, argument);
- });
+ // If [argument] has type variables or is a type variable, this method
+ // registers a RTI dependency between the class where the type variable is
+ // defined (that is the enclosing class of the current element being
+ // resolved) and the class of [type]. If the class of [type] requires RTI,
+ // then the class of the type variable does too.
+ ClassElement contextClass = Types.getClassContext(type);
+ if (contextClass != null) {
+ assert(contextClass == enclosingElement.getEnclosingClass().declaration);
+ rti.registerRtiDependency(type.element, contextClass);
}
}

Powered by Google App Engine
This is Rietveld 408576698