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

Side by Side Diff: pkg/compiler/lib/src/js_backend/codegen/glue.dart

Issue 1198293002: dart2js: Use an abstract Name class for names in the generated JavaScript ast. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: fix tests Created 5 years, 5 months 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
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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 library code_generator_dependencies; 5 library code_generator_dependencies;
6 6
7 import '../js_backend.dart'; 7 import '../js_backend.dart';
8 import '../../dart2jslib.dart'; 8 import '../../dart2jslib.dart';
9 import '../../js_emitter/js_emitter.dart'; 9 import '../../js_emitter/js_emitter.dart';
10 import '../../js/js.dart' as js; 10 import '../../js/js.dart' as js;
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 ConstructorElement get mapLiteralConstructor { 72 ConstructorElement get mapLiteralConstructor {
73 return _backend.mapLiteralConstructor; 73 return _backend.mapLiteralConstructor;
74 } 74 }
75 75
76 ConstructorElement get mapLiteralConstructorEmpty { 76 ConstructorElement get mapLiteralConstructorEmpty {
77 return _backend.mapLiteralConstructorEmpty; 77 return _backend.mapLiteralConstructorEmpty;
78 } 78 }
79 79
80 FunctionElement get identicalFunction => _compiler.identicalFunction; 80 FunctionElement get identicalFunction => _compiler.identicalFunction;
81 81
82 String invocationName(Selector selector) { 82 js.Name invocationName(Selector selector) {
83 return _namer.invocationName(selector); 83 return _namer.invocationName(selector);
84 } 84 }
85 85
86 FunctionElement get createInvocationMirrorMethod { 86 FunctionElement get createInvocationMirrorMethod {
87 return _backend.getCreateInvocationMirror(); 87 return _backend.getCreateInvocationMirror();
88 } 88 }
89 89
90 void registerUseInterceptorInCodegen() { 90 void registerUseInterceptorInCodegen() {
91 _backend.registerUseInterceptor(_enqueuer); 91 _backend.registerUseInterceptor(_enqueuer);
92 } 92 }
(...skipping 11 matching lines...) Expand all
104 } 104 }
105 105
106 void registerSpecializedGetInterceptor(Set<ClassElement> classes) { 106 void registerSpecializedGetInterceptor(Set<ClassElement> classes) {
107 _backend.registerSpecializedGetInterceptor(classes); 107 _backend.registerSpecializedGetInterceptor(classes);
108 } 108 }
109 109
110 js.Expression constructorAccess(ClassElement element) { 110 js.Expression constructorAccess(ClassElement element) {
111 return _backend.emitter.constructorAccess(element); 111 return _backend.emitter.constructorAccess(element);
112 } 112 }
113 113
114 String instanceFieldPropertyName(Element field) { 114 js.Name instanceFieldPropertyName(Element field) {
115 return _namer.instanceFieldPropertyName(field); 115 return _namer.instanceFieldPropertyName(field);
116 } 116 }
117 117
118 String instanceMethodName(FunctionElement element) { 118 js.Name instanceMethodName(FunctionElement element) {
119 return _namer.instanceMethodName(element); 119 return _namer.instanceMethodName(element);
120 } 120 }
121 121
122 js.Expression prototypeAccess(ClassElement e, 122 js.Expression prototypeAccess(ClassElement e,
123 {bool hasBeenInstantiated: false}) { 123 {bool hasBeenInstantiated: false}) {
124 return _emitter.prototypeAccess(e, 124 return _emitter.prototypeAccess(e,
125 hasBeenInstantiated: hasBeenInstantiated); 125 hasBeenInstantiated: hasBeenInstantiated);
126 } 126 }
127 127
128 String getInterceptorName(Set<ClassElement> interceptedClasses) { 128 js.Name getInterceptorName(Set<ClassElement> interceptedClasses) {
129 return _backend.namer.nameForGetInterceptor(interceptedClasses); 129 return _backend.namer.nameForGetInterceptor(interceptedClasses);
130 } 130 }
131 131
132 js.Expression getInterceptorLibrary() { 132 js.Expression getInterceptorLibrary() {
133 return new js.VariableUse( 133 return new js.VariableUse(
134 _backend.namer.globalObjectFor(_backend.interceptorsLibrary)); 134 _backend.namer.globalObjectFor(_backend.interceptorsLibrary));
135 } 135 }
136 136
137 FunctionElement getWrapExceptionHelper() { 137 FunctionElement getWrapExceptionHelper() {
138 return _backend.getWrapExceptionHelper(); 138 return _backend.getWrapExceptionHelper();
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 FunctionElement getCheckSubtypeOfRuntimeType() { 180 FunctionElement getCheckSubtypeOfRuntimeType() {
181 return _backend.getCheckSubtypeOfRuntimeType(); 181 return _backend.getCheckSubtypeOfRuntimeType();
182 } 182 }
183 183
184 /// subtypeOfRuntimeTypeCast(value, runtimeType) 184 /// subtypeOfRuntimeTypeCast(value, runtimeType)
185 FunctionElement getSubtypeOfRuntimeTypeCast() { 185 FunctionElement getSubtypeOfRuntimeTypeCast() {
186 return _backend.getSubtypeOfRuntimeTypeCast(); 186 return _backend.getSubtypeOfRuntimeTypeCast();
187 } 187 }
188 188
189 js.Expression getRuntimeTypeName(ClassElement cls) { 189 js.Expression getRuntimeTypeName(ClassElement cls) {
190 return js.string(_namer.runtimeTypeName(cls)); 190 return js.quoteName(_namer.runtimeTypeName(cls));
191 } 191 }
192 192
193 int getTypeVariableIndex(TypeVariableType variable) { 193 int getTypeVariableIndex(TypeVariableType variable) {
194 return RuntimeTypes.getTypeVariableIndex(variable.element); 194 return RuntimeTypes.getTypeVariableIndex(variable.element);
195 } 195 }
196 196
197 bool needsSubstitutionForTypeVariableAccess(ClassElement cls) { 197 bool needsSubstitutionForTypeVariableAccess(ClassElement cls) {
198 ClassWorld classWorld = _compiler.world; 198 ClassWorld classWorld = _compiler.world;
199 if (classWorld.isUsedAsMixin(cls)) return true; 199 if (classWorld.isUsedAsMixin(cls)) return true;
200 200
(...skipping 11 matching lines...) Expand all
212 (_) => arguments[variableIndex++]); 212 (_) => arguments[variableIndex++]);
213 assert(variableIndex == arguments.length); 213 assert(variableIndex == arguments.length);
214 return representation; 214 return representation;
215 } 215 }
216 216
217 void registerIsCheck(DartType type, Registry registry) { 217 void registerIsCheck(DartType type, Registry registry) {
218 _enqueuer.registerIsCheck(type); 218 _enqueuer.registerIsCheck(type);
219 _backend.registerIsCheckForCodegen(type, _enqueuer, registry); 219 _backend.registerIsCheckForCodegen(type, _enqueuer, registry);
220 } 220 }
221 221
222 String getTypeTestTag(DartType type) { 222 js.Name getTypeTestTag(DartType type) {
223 return _backend.namer.operatorIsType(type); 223 return _backend.namer.operatorIsType(type);
224 } 224 }
225 225
226 String getTypeSubstitutionTag(ClassElement element) { 226 js.Name getTypeSubstitutionTag(ClassElement element) {
227 return _backend.namer.substitutionName(element); 227 return _backend.namer.substitutionName(element);
228 } 228 }
229 229
230 bool operatorEqHandlesNullArgument(FunctionElement element) { 230 bool operatorEqHandlesNullArgument(FunctionElement element) {
231 return _backend.operatorEqHandlesNullArgument(element); 231 return _backend.operatorEqHandlesNullArgument(element);
232 } 232 }
233 233
234 bool hasStrictSubtype(ClassElement element) { 234 bool hasStrictSubtype(ClassElement element) {
235 return _compiler.world.hasAnyStrictSubtype(element); 235 return _compiler.world.hasAnyStrictSubtype(element);
236 } 236 }
237 } 237 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698