OLD | NEW |
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.js_emitter.lazy_emitter; | 5 library dart2js.js_emitter.lazy_emitter; |
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 '../../compiler.dart' show Compiler; | 10 import '../../compiler.dart' show Compiler; |
11 import '../../constants/values.dart' show ConstantValue; | 11 import '../../constants/values.dart' show ConstantValue; |
12 import '../../deferred_load.dart' show OutputUnit; | 12 import '../../deferred_load.dart' show OutputUnit; |
13 import '../../elements/elements.dart' | 13 import '../../elements/elements.dart' |
14 show ClassElement, Element, FieldElement, MethodElement; | 14 show ClassElement, Element, Entity, FieldElement, MethodElement; |
15 import '../../js/js.dart' as js; | 15 import '../../js/js.dart' as js; |
16 import '../../js_backend/js_backend.dart' show JavaScriptBackend, Namer; | 16 import '../../js_backend/js_backend.dart' show JavaScriptBackend, Namer; |
17 import '../../world.dart' show ClosedWorld; | 17 import '../../world.dart' show ClosedWorld; |
18 import '../js_emitter.dart' show CodeEmitterTask, NativeEmitter; | 18 import '../js_emitter.dart' show CodeEmitterTask, NativeEmitter; |
19 import '../js_emitter.dart' as emitterTask show Emitter, EmitterFactory; | 19 import '../js_emitter.dart' as emitterTask show Emitter, EmitterFactory; |
20 import '../model.dart'; | 20 import '../model.dart'; |
21 import '../program_builder/program_builder.dart' show ProgramBuilder; | 21 import '../program_builder/program_builder.dart' show ProgramBuilder; |
22 import 'model_emitter.dart'; | 22 import 'model_emitter.dart'; |
23 | 23 |
24 class EmitterFactory implements emitterTask.EmitterFactory { | 24 class EmitterFactory implements emitterTask.EmitterFactory { |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 } | 125 } |
126 | 126 |
127 @override | 127 @override |
128 js.Expression interceptorClassAccess(ClassElement element) { | 128 js.Expression interceptorClassAccess(ClassElement element) { |
129 // Some interceptors are eagerly constructed. However, native interceptors | 129 // Some interceptors are eagerly constructed. However, native interceptors |
130 // aren't. | 130 // aren't. |
131 return js.js('#.ensureResolved()', _globalPropertyAccess(element)); | 131 return js.js('#.ensureResolved()', _globalPropertyAccess(element)); |
132 } | 132 } |
133 | 133 |
134 @override | 134 @override |
135 js.Expression typeAccess(Element element) { | 135 js.Expression typeAccess(Entity element) { |
136 // TODO(floitsch): minify 'ensureResolved'. | 136 // TODO(floitsch): minify 'ensureResolved'. |
137 // TODO(floitsch): don't emit `ensureResolved` for eager classes. | 137 // TODO(floitsch): don't emit `ensureResolved` for eager classes. |
138 return js.js('#.ensureResolved()', _globalPropertyAccess(element)); | 138 return js.js('#.ensureResolved()', _globalPropertyAccess(element)); |
139 } | 139 } |
140 | 140 |
141 @override | 141 @override |
142 js.Template templateForBuiltin(JsBuiltin builtin) { | 142 js.Template templateForBuiltin(JsBuiltin builtin) { |
143 String typeNameProperty = ModelEmitter.typeNameProperty; | 143 String typeNameProperty = ModelEmitter.typeNameProperty; |
144 | 144 |
145 switch (builtin) { | 145 switch (builtin) { |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
188 } | 188 } |
189 } | 189 } |
190 | 190 |
191 @override | 191 @override |
192 // TODO(het): Generate this correctly | 192 // TODO(het): Generate this correctly |
193 int generatedSize(OutputUnit unit) => 0; | 193 int generatedSize(OutputUnit unit) => 0; |
194 | 194 |
195 @override | 195 @override |
196 void invalidateCaches() {} | 196 void invalidateCaches() {} |
197 } | 197 } |
OLD | NEW |