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

Side by Side Diff: pkg/compiler/lib/src/parser/diet_parser_task.dart

Issue 2685573002: Replace Backend with JavaScriptBackend. (Closed)
Patch Set: Updated cf. comment Created 3 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
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.parser.diet.task; 5 library dart2js.parser.diet.task;
6 6
7 import '../common.dart'; 7 import '../common.dart';
8 import '../common/backend_api.dart' show Backend;
9 import '../common/tasks.dart' show CompilerTask, Measurer; 8 import '../common/tasks.dart' show CompilerTask, Measurer;
10 import '../elements/elements.dart' show CompilationUnitElement; 9 import '../elements/elements.dart' show CompilationUnitElement;
10 import '../js_backend/backend.dart' show JavaScriptBackend;
11 import '../id_generator.dart'; 11 import '../id_generator.dart';
12 import 'package:front_end/src/fasta/scanner.dart' show Token; 12 import 'package:front_end/src/fasta/scanner.dart' show Token;
13 import 'element_listener.dart' show ElementListener, ScannerOptions; 13 import 'element_listener.dart' show ElementListener, ScannerOptions;
14 import 'package:front_end/src/fasta/parser.dart' 14 import 'package:front_end/src/fasta/parser.dart'
15 show Listener, ParserError, TopLevelParser; 15 show Listener, ParserError, TopLevelParser;
16 16
17 class PartialParser extends TopLevelParser { 17 class PartialParser extends TopLevelParser {
18 PartialParser(Listener listener) : super(listener); 18 PartialParser(Listener listener) : super(listener);
19 19
20 Token parseFormalParameters(Token token) => skipFormalParameters(token); 20 Token parseFormalParameters(Token token) => skipFormalParameters(token);
21 } 21 }
22 22
23 class DietParserTask extends CompilerTask { 23 class DietParserTask extends CompilerTask {
24 final IdGenerator _idGenerator; 24 final IdGenerator _idGenerator;
25 final Backend _backend; 25 final JavaScriptBackend _backend;
26 final DiagnosticReporter _reporter; 26 final DiagnosticReporter _reporter;
27 27
28 DietParserTask( 28 DietParserTask(
29 this._idGenerator, this._backend, this._reporter, Measurer measurer) 29 this._idGenerator, this._backend, this._reporter, Measurer measurer)
30 : super(measurer); 30 : super(measurer);
31 31
32 final String name = 'Diet Parser'; 32 final String name = 'Diet Parser';
33 33
34 dietParse(CompilationUnitElement compilationUnit, Token tokens) { 34 dietParse(CompilationUnitElement compilationUnit, Token tokens) {
35 measure(() { 35 measure(() {
36 ScannerOptions scannerOptions = new ScannerOptions( 36 ScannerOptions scannerOptions = new ScannerOptions(
37 canUseNative: _backend.canLibraryUseNative(compilationUnit.library)); 37 canUseNative: _backend.canLibraryUseNative(compilationUnit.library));
38 ElementListener listener = new ElementListener( 38 ElementListener listener = new ElementListener(
39 scannerOptions, _reporter, compilationUnit, _idGenerator); 39 scannerOptions, _reporter, compilationUnit, _idGenerator);
40 PartialParser parser = new PartialParser(listener); 40 PartialParser parser = new PartialParser(listener);
41 try { 41 try {
42 parser.parseUnit(tokens); 42 parser.parseUnit(tokens);
43 } on ParserError catch (_) { 43 } on ParserError catch (_) {
44 // TODO(johnniwinther): assert that the error was reported once there is 44 // TODO(johnniwinther): assert that the error was reported once there is
45 // a [hasErrorBeenReported] field in [DiagnosticReporter] 45 // a [hasErrorBeenReported] field in [DiagnosticReporter]
46 // The error should have already been reported by the parser. 46 // The error should have already been reported by the parser.
47 } 47 }
48 }); 48 });
49 } 49 }
50 } 50 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/js_backend/enqueuer.dart ('k') | pkg/compiler/lib/src/resolution/registry.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698