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 |
9 CompilerTask; | 9 CompilerTask; |
10 import '../compiler.dart' show | 10 import '../compiler.dart' show |
11 Compiler; | 11 Compiler; |
12 import '../elements/elements.dart' show | 12 import '../elements/elements.dart' show |
13 CompilationUnitElement; | 13 CompilationUnitElement; |
14 import '../tokens/token.dart' show | 14 import '../tokens/token.dart' show |
15 Token; | 15 Token; |
16 | 16 |
17 import 'listener.dart' show | 17 import 'listener.dart' show |
18 ParserError; | 18 ParserError; |
19 import 'element_listener.dart' show | 19 import 'element_listener.dart' show |
20 ElementListener, | 20 ElementListener, |
21 ScannerOptions; | 21 ScannerOptions; |
22 import 'partial_parser.dart' show | 22 import 'partial_parser.dart' show |
23 PartialParser; | 23 PartialParser; |
24 | 24 |
25 class DietParserTask extends CompilerTask { | 25 class DietParserTask extends CompilerTask { |
26 final bool _enableConditionalDirectives; | 26 final bool _enableConditionalDirectives; |
27 final bool _enableGenericMethods; | |
27 | 28 |
28 DietParserTask(Compiler compiler, {bool enableConditionalDirectives}) | 29 DietParserTask(Compiler compiler, |
30 {bool enableConditionalDirectives: false, | |
Johnni Winther
2016/02/29 10:18:45
Ditto
eernst
2016/03/09 16:28:13
Done, as described in comment for 'compiler.dart'.
| |
31 bool enableGenericMethods: false}) | |
29 : this._enableConditionalDirectives = enableConditionalDirectives, | 32 : this._enableConditionalDirectives = enableConditionalDirectives, |
33 this._enableGenericMethods = enableGenericMethods, | |
30 super(compiler); | 34 super(compiler); |
31 | 35 |
32 final String name = 'Diet Parser'; | 36 final String name = 'Diet Parser'; |
33 | 37 |
34 dietParse(CompilationUnitElement compilationUnit, Token tokens) { | 38 dietParse(CompilationUnitElement compilationUnit, Token tokens) { |
35 measure(() { | 39 measure(() { |
36 Function idGenerator = compiler.getNextFreeClassId; | 40 Function idGenerator = compiler.getNextFreeClassId; |
37 ScannerOptions scannerOptions = new ScannerOptions( | 41 ScannerOptions scannerOptions = new ScannerOptions( |
38 canUseNative: compiler.backend.canLibraryUseNative( | 42 canUseNative: compiler.backend.canLibraryUseNative( |
39 compilationUnit.library)); | 43 compilationUnit.library)); |
40 ElementListener listener = new ElementListener( | 44 ElementListener listener = new ElementListener( |
41 scannerOptions, compiler.reporter, compilationUnit, idGenerator); | 45 scannerOptions, compiler.reporter, compilationUnit, idGenerator); |
42 PartialParser parser = new PartialParser( | 46 PartialParser parser = new PartialParser( |
43 listener, enableConditionalDirectives: _enableConditionalDirectives); | 47 listener, |
48 enableConditionalDirectives: _enableConditionalDirectives, | |
49 enableGenericMethods: _enableGenericMethods); | |
44 try { | 50 try { |
45 parser.parseUnit(tokens); | 51 parser.parseUnit(tokens); |
46 } on ParserError catch(_) { | 52 } on ParserError catch(_) { |
47 assert(invariant(compilationUnit, compiler.compilationFailed)); | 53 assert(invariant(compilationUnit, compiler.compilationFailed)); |
48 } | 54 } |
49 }); | 55 }); |
50 } | 56 } |
51 } | 57 } |
OLD | NEW |