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

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

Issue 1383483006: Extract DiagnosticReporter implementation from Compiler. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Fixes after rebase. Created 5 years, 2 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) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, 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.startup_emitter; 5 library dart2js.js_emitter.startup_emitter;
6 6
7 import 'package:js_runtime/shared/embedded_names.dart' show 7 import 'package:js_runtime/shared/embedded_names.dart' show
8 JsBuiltin, 8 JsBuiltin,
9 METADATA, 9 METADATA,
10 STATIC_FUNCTION_NAME_TO_CLOSURE, 10 STATIC_FUNCTION_NAME_TO_CLOSURE,
11 TYPES; 11 TYPES;
12 12
13 import '../program_builder/program_builder.dart' show ProgramBuilder; 13 import '../program_builder/program_builder.dart' show ProgramBuilder;
14 import '../model.dart'; 14 import '../model.dart';
15 import 'model_emitter.dart'; 15 import 'model_emitter.dart';
16 import '../../common.dart'; 16 import '../../common.dart';
17 import '../../elements/elements.dart' show FieldElement; 17 import '../../elements/elements.dart' show FieldElement;
18 import '../../js/js.dart' as js; 18 import '../../js/js.dart' as js;
19 19
20 import '../../js_backend/js_backend.dart' show 20 import '../../js_backend/js_backend.dart' show
21 JavaScriptBackend, 21 JavaScriptBackend,
22 Namer; 22 Namer;
23 23
24 import '../js_emitter.dart' show 24 import '../js_emitter.dart' show
25 NativeEmitter; 25 NativeEmitter;
26 26
27 import '../js_emitter.dart' as emitterTask show 27 import '../js_emitter.dart' as emitterTask show
28 Emitter; 28 Emitter;
29 29
30 import '../../diagnostics/diagnostic_listener.dart' show
31 DiagnosticReporter;
32
30 import '../../diagnostics/spannable.dart' show 33 import '../../diagnostics/spannable.dart' show
31 NO_LOCATION_SPANNABLE; 34 NO_LOCATION_SPANNABLE;
32 35
33 class Emitter implements emitterTask.Emitter { 36 class Emitter implements emitterTask.Emitter {
34 final Compiler _compiler; 37 final Compiler _compiler;
35 final Namer namer; 38 final Namer namer;
36 final ModelEmitter _emitter; 39 final ModelEmitter _emitter;
37 40
38 JavaScriptBackend get _backend => _compiler.backend; 41 JavaScriptBackend get _backend => _compiler.backend;
39 42
40 Emitter(Compiler compiler, Namer namer, NativeEmitter nativeEmitter, 43 Emitter(Compiler compiler, Namer namer, NativeEmitter nativeEmitter,
41 bool shouldGenerateSourceMap) 44 bool shouldGenerateSourceMap)
42 : this._compiler = compiler, 45 : this._compiler = compiler,
43 this.namer = namer, 46 this.namer = namer,
44 _emitter = new ModelEmitter( 47 _emitter = new ModelEmitter(
45 compiler, namer, nativeEmitter, shouldGenerateSourceMap); 48 compiler, namer, nativeEmitter, shouldGenerateSourceMap);
46 49
50 DiagnosticReporter get reporter => _compiler.reporter;
51
47 @override 52 @override
48 String get patchVersion => "startup"; 53 String get patchVersion => "startup";
49 54
50 @override 55 @override
51 int emitProgram(ProgramBuilder programBuilder) { 56 int emitProgram(ProgramBuilder programBuilder) {
52 Program program = programBuilder.buildProgram(); 57 Program program = programBuilder.buildProgram();
53 return _emitter.emitProgram(program); 58 return _emitter.emitProgram(program);
54 } 59 }
55 60
56 @override 61 @override
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 String typesAccess = 182 String typesAccess =
178 _emitter.generateEmbeddedGlobalAccessString(TYPES); 183 _emitter.generateEmbeddedGlobalAccessString(TYPES);
179 return js.js.expressionTemplateFor("$typesAccess[#]"); 184 return js.js.expressionTemplateFor("$typesAccess[#]");
180 185
181 case JsBuiltin.createDartClosureFromNameOfStaticFunction: 186 case JsBuiltin.createDartClosureFromNameOfStaticFunction:
182 String functionAccess = _emitter.generateEmbeddedGlobalAccessString( 187 String functionAccess = _emitter.generateEmbeddedGlobalAccessString(
183 STATIC_FUNCTION_NAME_TO_CLOSURE); 188 STATIC_FUNCTION_NAME_TO_CLOSURE);
184 return js.js.expressionTemplateFor("$functionAccess(#)"); 189 return js.js.expressionTemplateFor("$functionAccess(#)");
185 190
186 default: 191 default:
187 _compiler.internalError(NO_LOCATION_SPANNABLE, 192 reporter.internalError(NO_LOCATION_SPANNABLE,
188 "Unhandled Builtin: $builtin"); 193 "Unhandled Builtin: $builtin");
189 return null; 194 return null;
190 } 195 }
191 } 196 }
192 197
193 @override 198 @override
194 void invalidateCaches() { 199 void invalidateCaches() {
195 } 200 }
196 } 201 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698