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

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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 /**
karlklose 2013/12/19 12:29:48 Change to '//' comment style, this is not a descri
Johnni Winther 2013/12/19 15:27:56 Done.
1010 * If [argument] has type variables or is a type variable, this 1010 * If [argument] has type variables or is a type variable, this
1011 * method registers a RTI dependency between the class where the 1011 * method registers a RTI dependency between the class where the
1012 * type variable is defined (that is the enclosing class of the 1012 * type variable is defined (that is the enclosing class of the
1013 * current element being resolved) and the class of [annotation]. 1013 * current element being resolved) and the class of [type].
1014 * If the class of [annotation] requires RTI, then the class of 1014 * If the class of [type] requires RTI, then the class of
1015 * the type variable does too. 1015 * the type variable does too.
1016 */ 1016 */
1017 void analyzeTypeArgument(DartType annotation, DartType argument) { 1017 ClassElement contextClass = Types.getClassContext(type);
1018 if (argument == null) return; 1018 if (contextClass != null) {
1019 if (argument.element.isTypeVariable()) { 1019 assert(contextClass == enclosingElement.getEnclosingClass().declaration);
1020 ClassElement enclosing = argument.element.getEnclosingClass(); 1020 rti.registerRtiDependency(type.element, contextClass);
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 } 1021 }
1037 } 1022 }
1038 1023
1039 void registerClassUsingVariableExpression(ClassElement cls) { 1024 void registerClassUsingVariableExpression(ClassElement cls) {
1040 rti.classesUsingTypeVariableExpression.add(cls); 1025 rti.classesUsingTypeVariableExpression.add(cls);
1041 } 1026 }
1042 1027
1043 bool classNeedsRti(ClassElement cls) { 1028 bool classNeedsRti(ClassElement cls) {
1044 return rti.classesNeedingRti.contains(cls.declaration) || 1029 return rti.classesNeedingRti.contains(cls.declaration) ||
1045 compiler.enabledRuntimeType; 1030 compiler.enabledRuntimeType;
(...skipping 816 matching lines...) Expand 10 before | Expand all | Expand 10 after
1862 copy(constant.values); 1847 copy(constant.values);
1863 copy(constant.protoValue); 1848 copy(constant.protoValue);
1864 copy(constant); 1849 copy(constant);
1865 } 1850 }
1866 1851
1867 void visitConstructed(ConstructedConstant constant) { 1852 void visitConstructed(ConstructedConstant constant) {
1868 copy(constant.fields); 1853 copy(constant.fields);
1869 copy(constant); 1854 copy(constant);
1870 } 1855 }
1871 } 1856 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698