| OLD | NEW |
| 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 | 7 import '../common/tasks.dart' show |
| 8 CompilerTask; | 8 CompilerTask; |
| 9 import '../compiler.dart' show | 9 import '../compiler.dart' show |
| 10 Compiler; | 10 Compiler; |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 | 39 |
| 40 void scan(CompilationUnitElement compilationUnit) { | 40 void scan(CompilationUnitElement compilationUnit) { |
| 41 measure(() { | 41 measure(() { |
| 42 scanElements(compilationUnit); | 42 scanElements(compilationUnit); |
| 43 }); | 43 }); |
| 44 } | 44 } |
| 45 | 45 |
| 46 void scanElements(CompilationUnitElement compilationUnit) { | 46 void scanElements(CompilationUnitElement compilationUnit) { |
| 47 Script script = compilationUnit.script; | 47 Script script = compilationUnit.script; |
| 48 Token tokens = new Scanner(script.file, | 48 Token tokens = new Scanner(script.file, |
| 49 includeComments: compiler.preserveComments).tokenize(); | 49 includeComments: compiler.options.preserveComments).tokenize(); |
| 50 if (compiler.preserveComments) { | 50 if (compiler.options.preserveComments) { |
| 51 tokens = compiler.processAndStripComments(tokens); | 51 tokens = compiler.processAndStripComments(tokens); |
| 52 } | 52 } |
| 53 compiler.dietParser.dietParse(compilationUnit, tokens); | 53 compiler.dietParser.dietParse(compilationUnit, tokens); |
| 54 } | 54 } |
| 55 | 55 |
| 56 /** | 56 /** |
| 57 * Returns the tokens for the [source]. | 57 * Returns the tokens for the [source]. |
| 58 * | 58 * |
| 59 * The [StringScanner] implementation works on strings that end with a '0' | 59 * The [StringScanner] implementation works on strings that end with a '0' |
| 60 * 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 |
| 61 * before scanning. | 61 * before scanning. |
| 62 */ | 62 */ |
| 63 Token tokenize(String source) { | 63 Token tokenize(String source) { |
| 64 return measure(() { | 64 return measure(() { |
| 65 return new StringScanner.fromString(source, includeComments: false) | 65 return new StringScanner.fromString(source, includeComments: false) |
| 66 .tokenize(); | 66 .tokenize(); |
| 67 }); | 67 }); |
| 68 } | 68 } |
| 69 } | 69 } |
| OLD | NEW |