| 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/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; | 
|  11 import '../elements/elements.dart' show |  11 import '../elements/elements.dart' show | 
|  12     CompilationUnitElement; |  12     CompilationUnitElement; | 
|  13 import '../diagnostics/invariant.dart' show |  13 import '../diagnostics/invariant.dart' show | 
|  14     invariant; |  14     invariant; | 
|  15 import '../tokens/token.dart' show |  15 import '../tokens/token.dart' show | 
|  16     Token; |  16     Token; | 
|  17  |  17  | 
|  18 import 'listener.dart' show |  18 import 'listener.dart' show | 
|  19     ParserError; |  19     ParserError; | 
|  20 import 'element_listener.dart' show |  20 import 'element_listener.dart' show | 
|  21     ElementListener; |  21     ElementListener; | 
|  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   DietParserTask(Compiler compiler) : super(compiler); |  26   final bool _enableConditionalDirectives; | 
 |  27  | 
 |  28   DietParserTask(Compiler compiler, {bool enableConditionalDirectives}) | 
 |  29       : this._enableConditionalDirectives = enableConditionalDirectives, | 
 |  30         super(compiler); | 
 |  31  | 
|  27   final String name = 'Diet Parser'; |  32   final String name = 'Diet Parser'; | 
|  28  |  33  | 
|  29   dietParse(CompilationUnitElement compilationUnit, Token tokens) { |  34   dietParse(CompilationUnitElement compilationUnit, Token tokens) { | 
|  30     measure(() { |  35     measure(() { | 
|  31       Function idGenerator = compiler.getNextFreeClassId; |  36       Function idGenerator = compiler.getNextFreeClassId; | 
|  32       ElementListener listener = |  37       ElementListener listener = | 
|  33           new ElementListener(compiler, compilationUnit, idGenerator); |  38           new ElementListener(compiler, compilationUnit, idGenerator); | 
|  34       PartialParser parser = new PartialParser(listener); |  39       PartialParser parser = new PartialParser( | 
 |  40           listener, enableConditionalDirectives: _enableConditionalDirectives); | 
|  35       try { |  41       try { | 
|  36         parser.parseUnit(tokens); |  42         parser.parseUnit(tokens); | 
|  37       } on ParserError catch(_) { |  43       } on ParserError catch(_) { | 
|  38         assert(invariant(compilationUnit, compiler.compilationFailed)); |  44         assert(invariant(compilationUnit, compiler.compilationFailed)); | 
|  39       } |  45       } | 
|  40     }); |  46     }); | 
|  41   } |  47   } | 
|  42 } |  48 } | 
| OLD | NEW |