| OLD | NEW |
| 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/tasks.dart' show | 8 import '../common/tasks.dart' show CompilerTask; |
| 9 CompilerTask; | 9 import '../compiler.dart' show Compiler; |
| 10 import '../compiler.dart' show | 10 import '../elements/elements.dart' show CompilationUnitElement; |
| 11 Compiler; | 11 import '../tokens/token.dart' show Token; |
| 12 import '../elements/elements.dart' show | |
| 13 CompilationUnitElement; | |
| 14 import '../tokens/token.dart' show | |
| 15 Token; | |
| 16 | 12 |
| 17 import 'listener.dart' show | 13 import 'listener.dart' show ParserError; |
| 18 ParserError; | 14 import 'element_listener.dart' show ElementListener, ScannerOptions; |
| 19 import 'element_listener.dart' show | 15 import '../options.dart' show ParserOptions; |
| 20 ElementListener, | 16 import 'partial_parser.dart' show PartialParser; |
| 21 ScannerOptions; | |
| 22 import '../options.dart' show | |
| 23 ParserOptions; | |
| 24 import 'partial_parser.dart' show | |
| 25 PartialParser; | |
| 26 | 17 |
| 27 class DietParserTask extends CompilerTask { | 18 class DietParserTask extends CompilerTask { |
| 28 final ParserOptions _parserOptions; | 19 final ParserOptions _parserOptions; |
| 29 | 20 |
| 30 DietParserTask(Compiler compiler, this._parserOptions) : super(compiler); | 21 DietParserTask(Compiler compiler, this._parserOptions) : super(compiler); |
| 31 | 22 |
| 32 final String name = 'Diet Parser'; | 23 final String name = 'Diet Parser'; |
| 33 | 24 |
| 34 dietParse(CompilationUnitElement compilationUnit, Token tokens) { | 25 dietParse(CompilationUnitElement compilationUnit, Token tokens) { |
| 35 measure(() { | 26 measure(() { |
| 36 Function idGenerator = compiler.getNextFreeClassId; | 27 Function idGenerator = compiler.getNextFreeClassId; |
| 37 ScannerOptions scannerOptions = | 28 ScannerOptions scannerOptions = |
| 38 new ScannerOptions.from(compiler, compilationUnit.library); | 29 new ScannerOptions.from(compiler, compilationUnit.library); |
| 39 ElementListener listener = new ElementListener( | 30 ElementListener listener = new ElementListener( |
| 40 scannerOptions, compiler.reporter, compilationUnit, idGenerator); | 31 scannerOptions, compiler.reporter, compilationUnit, idGenerator); |
| 41 PartialParser parser = new PartialParser(listener, _parserOptions); | 32 PartialParser parser = new PartialParser(listener, _parserOptions); |
| 42 try { | 33 try { |
| 43 parser.parseUnit(tokens); | 34 parser.parseUnit(tokens); |
| 44 } on ParserError catch(_) { | 35 } on ParserError catch (_) { |
| 45 assert(invariant(compilationUnit, compiler.compilationFailed)); | 36 assert(invariant(compilationUnit, compiler.compilationFailed)); |
| 46 } | 37 } |
| 47 }); | 38 }); |
| 48 } | 39 } |
| 49 } | 40 } |
| OLD | NEW |