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

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

Issue 880773003: dart2js: support native classes in the new emitter. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Rename blob to info. Created 5 years, 10 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';
11 import '../../elements/elements.dart' show FieldElement; 11 import '../../elements/elements.dart' show FieldElement;
12 import '../../js/js.dart' as js; 12 import '../../js/js.dart' as js;
13 13
14 import '../../js_backend/js_backend.dart' show Namer, JavaScriptBackend; 14 import '../../js_backend/js_backend.dart' show
15 JavaScriptBackend,
16 Namer;
17
18 import '../js_emitter.dart' show
19 NativeEmitter;
20
15 import '../js_emitter.dart' as emitterTask show 21 import '../js_emitter.dart' as emitterTask show
16 Emitter; 22 Emitter;
17 23
18 class Emitter implements emitterTask.Emitter { 24 class Emitter implements emitterTask.Emitter {
19 final Compiler _compiler; 25 final Compiler _compiler;
20 final Namer namer; 26 final Namer namer;
21 final ModelEmitter _emitter; 27 final ModelEmitter _emitter;
22 28
23 Emitter(Compiler compiler, Namer namer) 29 Emitter(Compiler compiler, Namer namer, NativeEmitter nativeEmitter)
24 : this._compiler = compiler, 30 : this._compiler = compiler,
25 this.namer = namer, 31 this.namer = namer,
26 _emitter = new ModelEmitter(compiler, namer); 32 _emitter = new ModelEmitter(compiler, namer, nativeEmitter);
27 33
28 @override 34 @override
29 int emitProgram(ProgramBuilder programBuilder) { 35 int emitProgram(ProgramBuilder programBuilder) {
30 Program program = programBuilder.buildProgram(); 36 Program program = programBuilder.buildProgram();
31 return _emitter.emitProgram(program); 37 return _emitter.emitProgram(program);
32 } 38 }
33 39
34 // TODO(floitsch): copied from OldEmitter. Adjust or share. 40 // TODO(floitsch): copied from OldEmitter. Adjust or share.
35 @override 41 @override
36 bool isConstantInlinedOrAlreadyEmitted(ConstantValue constant) { 42 bool isConstantInlinedOrAlreadyEmitted(ConstantValue constant) {
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 @override 143 @override
138 js.Expression typeAccess(Element element) { 144 js.Expression typeAccess(Element element) {
139 // TODO(floitsch): minify 'ensureResolved'. 145 // TODO(floitsch): minify 'ensureResolved'.
140 // TODO(floitsch): don't emit `ensureResolved` for eager classes. 146 // TODO(floitsch): don't emit `ensureResolved` for eager classes.
141 return js.js('#.ensureResolved()', _globalPropertyAccess(element)); 147 return js.js('#.ensureResolved()', _globalPropertyAccess(element));
142 } 148 }
143 149
144 @override 150 @override
145 void invalidateCaches() {} 151 void invalidateCaches() {}
146 } 152 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698