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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 part of js_backend; 5 part of js_backend;
6 6
7 const VERBOSE_OPTIMIZER_HINTS = false; 7 const VERBOSE_OPTIMIZER_HINTS = false;
8 8
9 class JavaScriptItemCompilationContext extends ItemCompilationContext { 9 class JavaScriptItemCompilationContext extends ItemCompilationContext {
10 final Set<HInstruction> boundsChecked = new Set<HInstruction>(); 10 final Set<HInstruction> boundsChecked = new Set<HInstruction>();
(...skipping 988 matching lines...) Expand 10 before | Expand all | Expand 10 after
999 999
1000 void registerSuperNoSuchMethod(TreeElements elements) { 1000 void registerSuperNoSuchMethod(TreeElements elements) {
1001 enqueueInResolution(getCreateInvocationMirror(), elements); 1001 enqueueInResolution(getCreateInvocationMirror(), elements);
1002 enqueueInResolution( 1002 enqueueInResolution(
1003 compiler.objectClass.lookupLocalMember(Compiler.NO_SUCH_METHOD), 1003 compiler.objectClass.lookupLocalMember(Compiler.NO_SUCH_METHOD),
1004 elements); 1004 elements);
1005 enqueueClass(compiler.enqueuer.resolution, compiler.listClass, elements); 1005 enqueueClass(compiler.enqueuer.resolution, compiler.listClass, elements);
1006 } 1006 }
1007 1007
1008 void registerRequiredType(DartType type, Element enclosingElement) { 1008 void registerRequiredType(DartType type, Element enclosingElement) {
1009 /** 1009 // If [argument] has type variables or is a type variable, this method
1010 * If [argument] has type variables or is a type variable, this 1010 // registers a RTI dependency between the class where the type variable is
1011 * method registers a RTI dependency between the class where the 1011 // defined (that is the enclosing class of the current element being
1012 * type variable is defined (that is the enclosing class of the 1012 // resolved) and the class of [type]. If the class of [type] requires RTI,
1013 * current element being resolved) and the class of [annotation]. 1013 // then the class of the type variable does too.
1014 * If the class of [annotation] requires RTI, then the class of 1014 ClassElement contextClass = Types.getClassContext(type);
1015 * the type variable does too. 1015 if (contextClass != null) {
1016 */ 1016 assert(contextClass == enclosingElement.getEnclosingClass().declaration);
1017 void analyzeTypeArgument(DartType annotation, DartType argument) { 1017 rti.registerRtiDependency(type.element, contextClass);
1018 if (argument == null) return;
1019 if (argument.element.isTypeVariable()) {
1020 ClassElement enclosing = argument.element.getEnclosingClass();
1021 assert(enclosing == enclosingElement.getEnclosingClass().declaration);
1022 rti.registerRtiDependency(annotation.element, enclosing);
1023 } else if (argument is InterfaceType) {
1024 InterfaceType type = argument;
1025 type.typeArguments.forEach((DartType argument) {
1026 analyzeTypeArgument(annotation, argument);
1027 });
1028 }
1029 }
1030
1031 if (type is InterfaceType) {
1032 InterfaceType itf = type;
1033 itf.typeArguments.forEach((DartType argument) {
1034 analyzeTypeArgument(type, argument);
1035 });
1036 } 1018 }
1037 } 1019 }
1038 1020
1039 void registerClassUsingVariableExpression(ClassElement cls) { 1021 void registerClassUsingVariableExpression(ClassElement cls) {
1040 rti.classesUsingTypeVariableExpression.add(cls); 1022 rti.classesUsingTypeVariableExpression.add(cls);
1041 } 1023 }
1042 1024
1043 bool classNeedsRti(ClassElement cls) { 1025 bool classNeedsRti(ClassElement cls) {
1044 return rti.classesNeedingRti.contains(cls.declaration) || 1026 return rti.classesNeedingRti.contains(cls.declaration) ||
1045 compiler.enabledRuntimeType; 1027 compiler.enabledRuntimeType;
(...skipping 816 matching lines...) Expand 10 before | Expand all | Expand 10 after
1862 copy(constant.values); 1844 copy(constant.values);
1863 copy(constant.protoValue); 1845 copy(constant.protoValue);
1864 copy(constant); 1846 copy(constant);
1865 } 1847 }
1866 1848
1867 void visitConstructed(ConstructedConstant constant) { 1849 void visitConstructed(ConstructedConstant constant) {
1868 copy(constant.fields); 1850 copy(constant.fields);
1869 copy(constant); 1851 copy(constant);
1870 } 1852 }
1871 } 1853 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698