| 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.new_js_emitter.emitter; | 5 library dart2js.new_js_emitter.emitter; |
| 6 | 6 |
| 7 import '../program_builder.dart' show ProgramBuilder; |
| 7 import '../model.dart'; | 8 import '../model.dart'; |
| 8 import 'model_emitter.dart'; | 9 import 'model_emitter.dart'; |
| 9 import '../../common.dart'; | 10 import '../../common.dart'; |
| 10 import '../../elements/elements.dart' show FieldElement; | 11 import '../../elements/elements.dart' show FieldElement; |
| 11 import '../../js/js.dart' as js; | 12 import '../../js/js.dart' as js; |
| 12 | 13 |
| 13 import '../../js_backend/js_backend.dart' show Namer, JavaScriptBackend; | 14 import '../../js_backend/js_backend.dart' show Namer, JavaScriptBackend; |
| 14 import '../../js_emitter/js_emitter.dart' as emitterTask show | 15 import '../js_emitter.dart' as emitterTask show |
| 15 CodeEmitterTask, | |
| 16 Emitter; | 16 Emitter; |
| 17 | 17 |
| 18 class Emitter implements emitterTask.Emitter { | 18 class Emitter implements emitterTask.Emitter { |
| 19 final Compiler _compiler; | 19 final Compiler _compiler; |
| 20 final Namer namer; | 20 final Namer namer; |
| 21 final ModelEmitter _emitter; | 21 final ModelEmitter _emitter; |
| 22 | 22 |
| 23 Emitter(Compiler compiler, Namer namer) | 23 Emitter(Compiler compiler, Namer namer) |
| 24 : this._compiler = compiler, | 24 : this._compiler = compiler, |
| 25 this.namer = namer, | 25 this.namer = namer, |
| 26 _emitter = new ModelEmitter(compiler, namer); | 26 _emitter = new ModelEmitter(compiler, namer); |
| 27 | 27 |
| 28 @override | 28 @override |
| 29 int emitProgram(Program program) { | 29 int emitProgram(ProgramBuilder programBuilder) { |
| 30 Program program = programBuilder.buildProgram(); |
| 30 return _emitter.emitProgram(program); | 31 return _emitter.emitProgram(program); |
| 31 } | 32 } |
| 32 | 33 |
| 33 // TODO(floitsch): copied from OldEmitter. Adjust or share. | 34 // TODO(floitsch): copied from OldEmitter. Adjust or share. |
| 34 @override | 35 @override |
| 35 bool isConstantInlinedOrAlreadyEmitted(ConstantValue constant) { | 36 bool isConstantInlinedOrAlreadyEmitted(ConstantValue constant) { |
| 36 if (constant.isFunction) return true; // Already emitted. | 37 if (constant.isFunction) return true; // Already emitted. |
| 37 if (constant.isPrimitive) return true; // Inlined. | 38 if (constant.isPrimitive) return true; // Inlined. |
| 38 if (constant.isDummy) return true; // Inlined. | 39 if (constant.isDummy) return true; // Inlined. |
| 39 // The name is null when the constant is already a JS constant. | 40 // The name is null when the constant is already a JS constant. |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 } | 141 } |
| 141 | 142 |
| 142 @override | 143 @override |
| 143 js.PropertyAccess closureClassConstructorAccess(ClassElement element) { | 144 js.PropertyAccess closureClassConstructorAccess(ClassElement element) { |
| 144 return _globalPropertyAccess(element); | 145 return _globalPropertyAccess(element); |
| 145 } | 146 } |
| 146 | 147 |
| 147 @override | 148 @override |
| 148 void invalidateCaches() {} | 149 void invalidateCaches() {} |
| 149 } | 150 } |
| OLD | NEW |