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 "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/tree/tree.dart"; | 10 import "package:compiler/src/tree/tree.dart"; |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 [void registerSource(Uri uri, String source)]) { | 118 [void registerSource(Uri uri, String source)]) { |
119 Token tokens = scan(text); | 119 Token tokens = scan(text); |
120 Uri uri = new Uri(scheme: "source", path: '${++sourceCounter}'); | 120 Uri uri = new Uri(scheme: "source", path: '${++sourceCounter}'); |
121 if (registerSource != null) { | 121 if (registerSource != null) { |
122 registerSource(uri, text); | 122 registerSource(uri, text); |
123 } | 123 } |
124 var script = new Script(uri, uri, new MockFile(text)); | 124 var script = new Script(uri, uri, new MockFile(text)); |
125 var unit = new CompilationUnitElementX(script, library); | 125 var unit = new CompilationUnitElementX(script, library); |
126 int id = 0; | 126 int id = 0; |
127 ElementListener listener = new ElementListener(compiler, unit, () => id++); | 127 ElementListener listener = new ElementListener(compiler, unit, () => id++); |
128 PartialParser parser = new PartialParser(listener); | 128 PartialParser parser = |
| 129 new PartialParser(listener, |
| 130 allowAssertMessage: compiler.allowAssertMessage); |
129 compiler.withCurrentElement(unit, () => parser.parseUnit(tokens)); | 131 compiler.withCurrentElement(unit, () => parser.parseUnit(tokens)); |
130 return unit.localMembers; | 132 return unit.localMembers; |
131 } | 133 } |
132 | 134 |
133 NodeList fullParseUnit(String source, {DiagnosticListener diagnosticHandler}) { | 135 NodeList fullParseUnit(String source, {DiagnosticListener diagnosticHandler}) { |
134 return parseBodyCode(source, (parser, tokens) => parser.parseUnit(tokens), | 136 return parseBodyCode(source, (parser, tokens) => parser.parseUnit(tokens), |
135 diagnosticHandler: diagnosticHandler); | 137 diagnosticHandler: diagnosticHandler); |
136 } | 138 } |
OLD | NEW |