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

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

Issue 1315483006: Split scannerlib.dart into several libraries. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Update try tests Created 5 years, 3 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
« no previous file with comments | « pkg/compiler/lib/src/scanner/scanner.dart ('k') | pkg/compiler/lib/src/scanner/scannerlib.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 part of scanner; 5 library dart2js.scanner.task;
6
7 import '../common/tasks.dart' show
8 CompilerTask;
9 import '../compiler.dart' show
10 Compiler;
11 import '../elements/elements.dart' show
12 CompilationUnitElement,
13 LibraryElement;
14 import '../script.dart' show
15 Script;
16
17 import 'scanner.dart' show
18 Scanner;
19 import 'string_scanner.dart' show
20 StringScanner;
21 import 'token.dart' show
22 Token;
6 23
7 class ScannerTask extends CompilerTask { 24 class ScannerTask extends CompilerTask {
8 ScannerTask(Compiler compiler) : super(compiler); 25 ScannerTask(Compiler compiler) : super(compiler);
9 String get name => 'Scanner'; 26 String get name => 'Scanner';
10 27
11 void scanLibrary(LibraryElement library) { 28 void scanLibrary(LibraryElement library) {
12 CompilationUnitElement compilationUnit = library.entryCompilationUnit; 29 CompilationUnitElement compilationUnit = library.entryCompilationUnit;
13 String canonicalUri = library.canonicalUri.toString(); 30 String canonicalUri = library.canonicalUri.toString();
14 String resolvedUri = compilationUnit.script.resourceUri.toString(); 31 String resolvedUri = compilationUnit.script.resourceUri.toString();
15 if (canonicalUri == resolvedUri) { 32 if (canonicalUri == resolvedUri) {
(...skipping 27 matching lines...) Expand all
43 * value ('\x00'). If [source] does not end with '0', the string is copied 60 * value ('\x00'). If [source] does not end with '0', the string is copied
44 * before scanning. 61 * before scanning.
45 */ 62 */
46 Token tokenize(String source) { 63 Token tokenize(String source) {
47 return measure(() { 64 return measure(() {
48 return new StringScanner.fromString(source, includeComments: false) 65 return new StringScanner.fromString(source, includeComments: false)
49 .tokenize(); 66 .tokenize();
50 }); 67 });
51 } 68 }
52 } 69 }
53
54 class DietParserTask extends CompilerTask {
55 DietParserTask(Compiler compiler) : super(compiler);
56 final String name = 'Diet Parser';
57
58 dietParse(CompilationUnitElement compilationUnit, Token tokens) {
59 measure(() {
60 Function idGenerator = compiler.getNextFreeClassId;
61 ElementListener listener =
62 new ElementListener(compiler, compilationUnit, idGenerator);
63 PartialParser parser = new PartialParser(listener);
64 try {
65 parser.parseUnit(tokens);
66 } on ParserError catch(_) {
67 assert(invariant(compilationUnit, compiler.compilationFailed));
68 }
69 });
70 }
71 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/scanner/scanner.dart ('k') | pkg/compiler/lib/src/scanner/scannerlib.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698