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

Side by Side Diff: pkg/compiler/lib/src/js_emitter/code_emitter_task.dart

Issue 2907373002: Use entities for globals in Namer. (Closed)
Patch Set: Updated cf. comments Created 3 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) 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 library dart2js.js_emitter.code_emitter_task; 5 library dart2js.js_emitter.code_emitter_task;
6 6
7 import 'package:js_runtime/shared/embedded_names.dart' show JsBuiltin; 7 import 'package:js_runtime/shared/embedded_names.dart' show JsBuiltin;
8 8
9 import '../common.dart'; 9 import '../common.dart';
10 import '../common/tasks.dart' show CompilerTask; 10 import '../common/tasks.dart' show CompilerTask;
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after
281 281
282 /// Returns the JS code for accessing the given [constant]. 282 /// Returns the JS code for accessing the given [constant].
283 jsAst.Expression constantReference(ConstantValue constant); 283 jsAst.Expression constantReference(ConstantValue constant);
284 284
285 /// Returns the JS template for the given [builtin]. 285 /// Returns the JS template for the given [builtin].
286 jsAst.Template templateForBuiltin(JsBuiltin builtin); 286 jsAst.Template templateForBuiltin(JsBuiltin builtin);
287 287
288 /// Returns the size of the code generated for a given output [unit]. 288 /// Returns the size of the code generated for a given output [unit].
289 int generatedSize(OutputUnit unit); 289 int generatedSize(OutputUnit unit);
290 } 290 }
291
292 abstract class EmitterBase implements Emitter {
293 Namer get namer;
294
295 jsAst.PropertyAccess globalPropertyAccessForMember(MemberEntity element) {
296 jsAst.Name name = namer.globalPropertyNameForMember(element);
297 jsAst.PropertyAccess pa = new jsAst.PropertyAccess(
298 new jsAst.VariableUse(namer.globalObjectForMember(element)), name);
299 return pa;
300 }
301
302 jsAst.PropertyAccess globalPropertyAccessForClass(ClassEntity element) {
303 jsAst.Name name = namer.globalPropertyNameForClass(element);
304 jsAst.PropertyAccess pa = new jsAst.PropertyAccess(
305 new jsAst.VariableUse(namer.globalObjectForClass(element)), name);
306 return pa;
307 }
308
309 jsAst.PropertyAccess globalPropertyAccessForType(Entity element) {
310 jsAst.Name name = namer.globalPropertyNameForType(element);
311 jsAst.PropertyAccess pa = new jsAst.PropertyAccess(
312 new jsAst.VariableUse(namer.globalObjectForType(element)), name);
313 return pa;
314 }
315
316 @override
317 jsAst.PropertyAccess staticFieldAccess(FieldEntity element) {
318 return globalPropertyAccessForMember(element);
319 }
320
321 @override
322 jsAst.PropertyAccess staticFunctionAccess(FunctionEntity element) {
323 return globalPropertyAccessForMember(element);
324 }
325
326 @override
327 jsAst.PropertyAccess constructorAccess(ClassEntity element) {
328 return globalPropertyAccessForClass(element);
329 }
330
331 @override
332 jsAst.PropertyAccess interceptorClassAccess(ClassEntity element) {
333 return globalPropertyAccessForClass(element);
334 }
335
336 @override
337 jsAst.PropertyAccess typeAccess(Entity element) {
338 return globalPropertyAccessForType(element);
339 }
340 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/js_backend/namer.dart ('k') | pkg/compiler/lib/src/js_emitter/full_emitter/emitter.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698