| OLD | NEW |
| 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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 parser_helper; | 5 library parser_helper; |
| 6 | 6 |
| 7 import 'package:expect/expect.dart'; | 7 import 'package:expect/expect.dart'; |
| 8 | 8 |
| 9 import 'package:compiler/src/elements/elements.dart'; | 9 import 'package:compiler/src/elements/elements.dart'; |
| 10 import 'package:compiler/src/id_generator.dart'; | 10 import 'package:compiler/src/id_generator.dart'; |
| 11 import 'package:compiler/src/tree/tree.dart'; | 11 import 'package:compiler/src/tree/tree.dart'; |
| 12 import 'package:compiler/src/parser/element_listener.dart'; | 12 import 'package:compiler/src/parser/element_listener.dart'; |
| 13 import 'package:compiler/src/parser/node_listener.dart'; | 13 import 'package:compiler/src/parser/node_listener.dart'; |
| 14 import 'package:compiler/src/parser/partial_elements.dart'; | 14 import 'package:compiler/src/parser/diet_parser_task.dart'; |
| 15 import 'package:dart_parser/dart_parser.dart' hide parse; | 15 import 'package:dart_parser/dart_parser.dart' hide parse; |
| 16 import 'package:dart_scanner/dart_scanner.dart' hide scan; | 16 import 'package:dart_scanner/dart_scanner.dart' hide scan; |
| 17 import 'package:compiler/src/io/source_file.dart'; | 17 import 'package:compiler/src/io/source_file.dart'; |
| 18 import 'package:compiler/src/util/util.dart'; | 18 import 'package:compiler/src/util/util.dart'; |
| 19 | 19 |
| 20 import 'package:compiler/src/elements/modelx.dart' | 20 import 'package:compiler/src/elements/modelx.dart' |
| 21 show CompilationUnitElementX, ElementX, LibraryElementX; | 21 show CompilationUnitElementX, ElementX, LibraryElementX; |
| 22 | 22 |
| 23 import 'package:compiler/src/compiler.dart'; | 23 import 'package:compiler/src/compiler.dart'; |
| 24 import 'package:compiler/src/options.dart'; | 24 import 'package:compiler/src/options.dart'; |
| 25 import 'package:compiler/src/diagnostics/source_span.dart'; | 25 import 'package:compiler/src/diagnostics/source_span.dart'; |
| 26 import 'package:compiler/src/diagnostics/spannable.dart'; | 26 import 'package:compiler/src/diagnostics/spannable.dart'; |
| 27 import 'package:compiler/src/diagnostics/diagnostic_listener.dart'; | 27 import 'package:compiler/src/diagnostics/diagnostic_listener.dart'; |
| 28 import 'package:compiler/src/diagnostics/messages.dart'; | 28 import 'package:compiler/src/diagnostics/messages.dart'; |
| 29 import 'package:compiler/src/script.dart'; | 29 import 'package:compiler/src/script.dart'; |
| 30 | 30 |
| 31 import 'options_helper.dart'; | 31 import 'options_helper.dart'; |
| 32 | 32 |
| 33 export 'package:dart_parser/dart_parser.dart' hide parse; | 33 export 'package:dart_parser/dart_parser.dart' hide parse; |
| 34 export 'package:dart_scanner/dart_scanner.dart' hide scan; | 34 export 'package:dart_scanner/dart_scanner.dart' hide scan; |
| 35 export 'package:compiler/src/diagnostics/diagnostic_listener.dart'; | 35 export 'package:compiler/src/diagnostics/diagnostic_listener.dart'; |
| 36 export 'package:compiler/src/parser/node_listener.dart'; | 36 export 'package:compiler/src/parser/node_listener.dart'; |
| 37 export 'package:compiler/src/parser/partial_elements.dart'; | 37 export 'package:compiler/src/parser/diet_parser_task.dart'; |
| 38 export 'package:dart_scanner/src/token_constants.dart'; | 38 export 'package:dart_scanner/src/token_constants.dart'; |
| 39 | 39 |
| 40 class LoggerCanceler extends DiagnosticReporter { | 40 class LoggerCanceler extends DiagnosticReporter { |
| 41 DiagnosticOptions get options => const MockDiagnosticOptions(); | 41 DiagnosticOptions get options => const MockDiagnosticOptions(); |
| 42 | 42 |
| 43 void log(message) { | 43 void log(message) { |
| 44 print(message); | 44 print(message); |
| 45 } | 45 } |
| 46 | 46 |
| 47 void internalError(node, String message) { | 47 void internalError(node, String message) { |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 new IdGenerator()); | 150 new IdGenerator()); |
| 151 PartialParser parser = new PartialParser(listener); | 151 PartialParser parser = new PartialParser(listener); |
| 152 reporter.withCurrentElement(unit, () => parser.parseUnit(tokens)); | 152 reporter.withCurrentElement(unit, () => parser.parseUnit(tokens)); |
| 153 return unit.localMembers; | 153 return unit.localMembers; |
| 154 } | 154 } |
| 155 | 155 |
| 156 NodeList fullParseUnit(String source, {DiagnosticReporter reporter}) { | 156 NodeList fullParseUnit(String source, {DiagnosticReporter reporter}) { |
| 157 return parseBodyCode(source, (parser, tokens) => parser.parseUnit(tokens), | 157 return parseBodyCode(source, (parser, tokens) => parser.parseUnit(tokens), |
| 158 reporter: reporter); | 158 reporter: reporter); |
| 159 } | 159 } |
| OLD | NEW |