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

Side by Side Diff: pkg/compiler/lib/src/scanner/scanner_task.dart

Issue 2000323006: Make CompilerTask independent of compiler. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 7 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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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.scanner.task; 5 library dart2js.scanner.task;
6 6
7 import '../common/tasks.dart' show CompilerTask; 7 import '../common/tasks.dart' show CompilerTask, Measurer;
8 import '../compiler.dart' show Compiler; 8 import '../diagnostics/diagnostic_listener.dart' show DiagnosticReporter;
9 import '../elements/elements.dart' show CompilationUnitElement, LibraryElement; 9 import '../elements/elements.dart' show CompilationUnitElement, LibraryElement;
10 import '../script.dart' show Script; 10 import '../script.dart' show Script;
11 import '../parser/diet_parser_task.dart' show DietParserTask; 11 import '../parser/diet_parser_task.dart' show DietParserTask;
12 import '../tokens/token.dart' show Token; 12 import '../tokens/token.dart' show Token;
13 import '../tokens/token_constants.dart' as Tokens show COMMENT_TOKEN, EOF_TOKEN; 13 import '../tokens/token_constants.dart' as Tokens show COMMENT_TOKEN, EOF_TOKEN;
14 import '../tokens/token_map.dart' show TokenMap; 14 import '../tokens/token_map.dart' show TokenMap;
15 15
16 import 'scanner.dart' show Scanner; 16 import 'scanner.dart' show Scanner;
17 import 'string_scanner.dart' show StringScanner; 17 import 'string_scanner.dart' show StringScanner;
18 18
19 class ScannerTask extends CompilerTask { 19 class ScannerTask extends CompilerTask {
20 final DietParserTask _dietParser; 20 final DietParserTask _dietParser;
21 final bool _preserveComments; 21 final bool _preserveComments;
22 final TokenMap _commentMap; 22 final TokenMap _commentMap;
23 final DiagnosticReporter reporter;
23 24
24 ScannerTask(Compiler compiler, this._dietParser, 25 ScannerTask(this._dietParser, this.reporter, Measurer measurer,
25 {bool preserveComments: false, TokenMap commentMap}) 26 {bool preserveComments: false, TokenMap commentMap})
26 : _preserveComments = preserveComments, 27 : _preserveComments = preserveComments,
27 _commentMap = commentMap, 28 _commentMap = commentMap,
28 super(compiler) { 29 super(measurer) {
29 if (_preserveComments && _commentMap == null) { 30 if (_preserveComments && _commentMap == null) {
30 throw new ArgumentError( 31 throw new ArgumentError(
31 "commentMap must be provided if preserveComments is true"); 32 "commentMap must be provided if preserveComments is true");
32 } 33 }
33 } 34 }
34 35
35 String get name => 'Scanner'; 36 String get name => 'Scanner';
36 37
37 void scanLibrary(LibraryElement library) { 38 void scanLibrary(LibraryElement library) {
38 CompilationUnitElement compilationUnit = library.entryCompilationUnit; 39 CompilationUnitElement compilationUnit = library.entryCompilationUnit;
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 } else { 92 } else {
92 prevToken.next = currentToken; 93 prevToken.next = currentToken;
93 } 94 }
94 } 95 }
95 prevToken = currentToken; 96 prevToken = currentToken;
96 currentToken = currentToken.next; 97 currentToken = currentToken.next;
97 } 98 }
98 return firstToken; 99 return firstToken;
99 } 100 }
100 } 101 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698