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

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 new emitter. Created 5 years, 6 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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 ConstructorElement get mapLiteralConstructor { 76 ConstructorElement get mapLiteralConstructor {
77 return _backend.mapLiteralConstructor; 77 return _backend.mapLiteralConstructor;
78 } 78 }
79 79
80 ConstructorElement get mapLiteralConstructorEmpty { 80 ConstructorElement get mapLiteralConstructorEmpty {
81 return _backend.mapLiteralConstructorEmpty; 81 return _backend.mapLiteralConstructorEmpty;
82 } 82 }
83 83
84 FunctionElement get identicalFunction => _compiler.identicalFunction; 84 FunctionElement get identicalFunction => _compiler.identicalFunction;
85 85
86 String invocationName(Selector selector) { 86 js.Name invocationName(Selector selector) {
87 return _namer.invocationName(selector); 87 return _namer.invocationName(selector);
88 } 88 }
89 89
90 FunctionElement get createInvocationMirrorMethod { 90 FunctionElement get createInvocationMirrorMethod {
91 return _backend.getCreateInvocationMirror(); 91 return _backend.getCreateInvocationMirror();
92 } 92 }
93 93
94 void registerUseInterceptorInCodegen() { 94 void registerUseInterceptorInCodegen() {
95 _backend.registerUseInterceptor(_enqueuer); 95 _backend.registerUseInterceptor(_enqueuer);
96 } 96 }
(...skipping 11 matching lines...) Expand all
108 } 108 }
109 109
110 void registerSpecializedGetInterceptor(Set<ClassElement> classes) { 110 void registerSpecializedGetInterceptor(Set<ClassElement> classes) {
111 _backend.registerSpecializedGetInterceptor(classes); 111 _backend.registerSpecializedGetInterceptor(classes);
112 } 112 }
113 113
114 js.Expression constructorAccess(ClassElement element) { 114 js.Expression constructorAccess(ClassElement element) {
115 return _backend.emitter.constructorAccess(element); 115 return _backend.emitter.constructorAccess(element);
116 } 116 }
117 117
118 String instanceFieldPropertyName(Element field) { 118 js.Name instanceFieldPropertyName(Element field) {
119 return _namer.instanceFieldPropertyName(field); 119 return _namer.instanceFieldPropertyName(field);
120 } 120 }
121 121
122 String instanceMethodName(FunctionElement element) { 122 js.Name instanceMethodName(FunctionElement element) {
123 return _namer.instanceMethodName(element); 123 return _namer.instanceMethodName(element);
124 } 124 }
125 125
126 js.Expression prototypeAccess(ClassElement e, 126 js.Expression prototypeAccess(ClassElement e,
127 {bool hasBeenInstantiated: false}) { 127 {bool hasBeenInstantiated: false}) {
128 return _emitter.prototypeAccess(e, 128 return _emitter.prototypeAccess(e,
129 hasBeenInstantiated: hasBeenInstantiated); 129 hasBeenInstantiated: hasBeenInstantiated);
130 } 130 }
131 131
132 String getInterceptorName(Set<ClassElement> interceptedClasses) { 132 js.Name getInterceptorName(Set<ClassElement> interceptedClasses) {
133 return _backend.namer.nameForGetInterceptor(interceptedClasses); 133 return _backend.namer.nameForGetInterceptor(interceptedClasses);
134 } 134 }
135 135
136 js.Expression getInterceptorLibrary() { 136 js.Expression getInterceptorLibrary() {
137 return new js.VariableUse( 137 return new js.VariableUse(
138 _backend.namer.globalObjectFor(_backend.interceptorsLibrary)); 138 _backend.namer.globalObjectFor(_backend.interceptorsLibrary));
139 } 139 }
140 140
141 FunctionElement getWrapExceptionHelper() { 141 FunctionElement getWrapExceptionHelper() {
142 return _backend.getWrapExceptionHelper(); 142 return _backend.getWrapExceptionHelper();
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 FunctionElement getCheckSubtypeOfRuntimeType() { 184 FunctionElement getCheckSubtypeOfRuntimeType() {
185 return _backend.getCheckSubtypeOfRuntimeType(); 185 return _backend.getCheckSubtypeOfRuntimeType();
186 } 186 }
187 187
188 /// subtypeOfRuntimeTypeCast(value, runtimeType) 188 /// subtypeOfRuntimeTypeCast(value, runtimeType)
189 FunctionElement getSubtypeOfRuntimeTypeCast() { 189 FunctionElement getSubtypeOfRuntimeTypeCast() {
190 return _backend.getSubtypeOfRuntimeTypeCast(); 190 return _backend.getSubtypeOfRuntimeTypeCast();
191 } 191 }
192 192
193 js.Expression getRuntimeTypeName(ClassElement cls) { 193 js.Expression getRuntimeTypeName(ClassElement cls) {
194 return js.string(_namer.runtimeTypeName(cls)); 194 return js.quoteName(_namer.runtimeTypeName(cls));
195 } 195 }
196 196
197 int getTypeVariableIndex(TypeVariableType variable) { 197 int getTypeVariableIndex(TypeVariableType variable) {
198 return RuntimeTypes.getTypeVariableIndex(variable.element); 198 return RuntimeTypes.getTypeVariableIndex(variable.element);
199 } 199 }
200 200
201 bool needsSubstitutionForTypeVariableAccess(ClassElement cls) { 201 bool needsSubstitutionForTypeVariableAccess(ClassElement cls) {
202 ClassWorld classWorld = _compiler.world; 202 ClassWorld classWorld = _compiler.world;
203 if (classWorld.isUsedAsMixin(cls)) return true; 203 if (classWorld.isUsedAsMixin(cls)) return true;
204 204
(...skipping 11 matching lines...) Expand all
216 (_) => arguments[variableIndex++]); 216 (_) => arguments[variableIndex++]);
217 assert(variableIndex == arguments.length); 217 assert(variableIndex == arguments.length);
218 return representation; 218 return representation;
219 } 219 }
220 220
221 void registerIsCheck(DartType type, Registry registry) { 221 void registerIsCheck(DartType type, Registry registry) {
222 _enqueuer.registerIsCheck(type); 222 _enqueuer.registerIsCheck(type);
223 _backend.registerIsCheckForCodegen(type, _enqueuer, registry); 223 _backend.registerIsCheckForCodegen(type, _enqueuer, registry);
224 } 224 }
225 225
226 String getTypeTestTag(DartType type) { 226 js.Name getTypeTestTag(DartType type) {
227 return _backend.namer.operatorIsType(type); 227 return _backend.namer.operatorIsType(type);
228 } 228 }
229 229
230 String getTypeSubstitutionTag(ClassElement element) { 230 js.Name getTypeSubstitutionTag(ClassElement element) {
231 return _backend.namer.substitutionName(element); 231 return _backend.namer.substitutionName(element);
232 } 232 }
233 233
234 bool operatorEqHandlesNullArgument(FunctionElement element) { 234 bool operatorEqHandlesNullArgument(FunctionElement element) {
235 return _backend.operatorEqHandlesNullArgument(element); 235 return _backend.operatorEqHandlesNullArgument(element);
236 } 236 }
237 237
238 bool hasStrictSubtype(ClassElement element) { 238 bool hasStrictSubtype(ClassElement element) {
239 return _compiler.world.hasAnyStrictSubtype(element); 239 return _compiler.world.hasAnyStrictSubtype(element);
240 } 240 }
241 } 241 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698