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