| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 "dart:uri"; | 7 import "dart:uri"; |
| 8 | 8 |
| 9 import "../../../sdk/lib/_internal/compiler/implementation/elements/elements.dar
t"; | 9 import "../../../sdk/lib/_internal/compiler/implementation/elements/elements.dar
t"; |
| 10 import "../../../sdk/lib/_internal/compiler/implementation/tree/tree.dart"; | 10 import "../../../sdk/lib/_internal/compiler/implementation/tree/tree.dart"; |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 Uri uri = new Uri.fromComponents(scheme: "source"); | 78 Uri uri = new Uri.fromComponents(scheme: "source"); |
| 79 var script = new Script(uri, new MockFile(text)); | 79 var script = new Script(uri, new MockFile(text)); |
| 80 var unit = new CompilationUnitElement(script, library); | 80 var unit = new CompilationUnitElement(script, library); |
| 81 int id = 0; | 81 int id = 0; |
| 82 ElementListener listener = new ElementListener(compiler, unit, () => id++); | 82 ElementListener listener = new ElementListener(compiler, unit, () => id++); |
| 83 PartialParser parser = new PartialParser(listener); | 83 PartialParser parser = new PartialParser(listener); |
| 84 compiler.withCurrentElement(unit, () => parser.parseUnit(tokens)); | 84 compiler.withCurrentElement(unit, () => parser.parseUnit(tokens)); |
| 85 return unit.localMembers; | 85 return unit.localMembers; |
| 86 } | 86 } |
| 87 | 87 |
| 88 NodeList fullParseUnit(String source) { | 88 NodeList fullParseUnit(String source, {DiagnosticListener diagnosticHandler}) { |
| 89 return parseBodyCode(source, (parser, tokens) => parser.parseUnit(tokens)); | 89 return parseBodyCode(source, (parser, tokens) => parser.parseUnit(tokens), |
| 90 diagnosticHandler: diagnosticHandler); |
| 90 } | 91 } |
| 91 | 92 |
| 92 // TODO(ahe): We define this method to avoid having to import | 93 // TODO(ahe): We define this method to avoid having to import |
| 93 // the scanner in the tests. We should move SourceString to another | 94 // the scanner in the tests. We should move SourceString to another |
| 94 // location instead. | 95 // location instead. |
| 95 SourceString buildSourceString(String name) { | 96 SourceString buildSourceString(String name) { |
| 96 return new SourceString(name); | 97 return new SourceString(name); |
| 97 } | 98 } |
| OLD | NEW |