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

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

Issue 891673003: dart2js: Refactoring, documentation, and a few bugfixes in Namer class. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Rebase Created 5 years, 9 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 | Annotate | Revision Log
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 dart2js.new_js_emitter.emitter; 5 library dart2js.new_js_emitter.emitter;
6 6
7 import '../program_builder.dart' show ProgramBuilder; 7 import '../program_builder.dart' show ProgramBuilder;
8 import '../model.dart'; 8 import '../model.dart';
9 import 'model_emitter.dart'; 9 import 'model_emitter.dart';
10 import '../../common.dart'; 10 import '../../common.dart';
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 js.Expression generateFunctionThatReturnsNull() { 84 js.Expression generateFunctionThatReturnsNull() {
85 return js.js('function() {}'); 85 return js.js('function() {}');
86 } 86 }
87 87
88 @override 88 @override
89 js.Expression constantReference(ConstantValue value) { 89 js.Expression constantReference(ConstantValue value) {
90 return _emitter.constantEmitter.reference(value); 90 return _emitter.constantEmitter.reference(value);
91 } 91 }
92 92
93 js.PropertyAccess _globalPropertyAccess(Element element) { 93 js.PropertyAccess _globalPropertyAccess(Element element) {
94 String name = namer.getNameX(element); 94 String name = namer.globalPropertyName(element);
95 js.PropertyAccess pa = new js.PropertyAccess.field( 95 js.PropertyAccess pa = new js.PropertyAccess.field(
96 new js.VariableUse(namer.globalObjectFor(element)), 96 new js.VariableUse(namer.globalObjectFor(element)),
97 name); 97 name);
98 return pa; 98 return pa;
99 } 99 }
100 100
101 @override 101 @override
102 js.Expression isolateLazyInitializerAccess(FieldElement element) { 102 js.Expression isolateLazyInitializerAccess(FieldElement element) {
103 return js.js('#.#', [namer.globalObjectFor(element), 103 return js.js('#.#', [namer.globalObjectFor(element),
104 namer.getLazyInitializerName(element)]); 104 namer.lazyInitializerName(element)]);
105 } 105 }
106 106
107 @override 107 @override
108 js.Expression isolateStaticClosureAccess(FunctionElement element) { 108 js.Expression isolateStaticClosureAccess(FunctionElement element) {
109 return js.js('#.#()', 109 return js.js('#.#()',
110 [namer.globalObjectFor(element), namer.getStaticClosureName(element)]); 110 [namer.globalObjectFor(element), namer.staticClosureName(element)]);
111 } 111 }
112 112
113 @override 113 @override
114 js.PropertyAccess staticFieldAccess(FieldElement element) { 114 js.PropertyAccess staticFieldAccess(FieldElement element) {
115 return _globalPropertyAccess(element); 115 return _globalPropertyAccess(element);
116 } 116 }
117 117
118 @override 118 @override
119 js.PropertyAccess staticFunctionAccess(FunctionElement element) { 119 js.PropertyAccess staticFunctionAccess(FunctionElement element) {
120 return _globalPropertyAccess(element); 120 return _globalPropertyAccess(element);
(...skipping 22 matching lines...) Expand all
143 @override 143 @override
144 js.Expression typeAccess(Element element) { 144 js.Expression typeAccess(Element element) {
145 // TODO(floitsch): minify 'ensureResolved'. 145 // TODO(floitsch): minify 'ensureResolved'.
146 // TODO(floitsch): don't emit `ensureResolved` for eager classes. 146 // TODO(floitsch): don't emit `ensureResolved` for eager classes.
147 return js.js('#.ensureResolved()', _globalPropertyAccess(element)); 147 return js.js('#.ensureResolved()', _globalPropertyAccess(element));
148 } 148 }
149 149
150 @override 150 @override
151 void invalidateCaches() {} 151 void invalidateCaches() {}
152 } 152 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698