| 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("../../../lib/compiler/implementation/elements/elements.dart"); | 9 #import("../../../lib/compiler/implementation/elements/elements.dart"); |
| 10 #import("../../../lib/compiler/implementation/tree/tree.dart"); | 10 #import("../../../lib/compiler/implementation/tree/tree.dart"); |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 Link<Element> parseUnit(String text, Compiler compiler, | 65 Link<Element> parseUnit(String text, Compiler compiler, |
| 66 LibraryElement library) { | 66 LibraryElement library) { |
| 67 Token tokens = scan(text); | 67 Token tokens = scan(text); |
| 68 Uri uri = new Uri.fromComponents(scheme: "source"); | 68 Uri uri = new Uri.fromComponents(scheme: "source"); |
| 69 var script = new Script(uri, new MockFile(text)); | 69 var script = new Script(uri, new MockFile(text)); |
| 70 var unit = new CompilationUnitElement(script, library); | 70 var unit = new CompilationUnitElement(script, library); |
| 71 int id = 0; | 71 int id = 0; |
| 72 ElementListener listener = new ElementListener(compiler, unit, () => id++); | 72 ElementListener listener = new ElementListener(compiler, unit, () => id++); |
| 73 PartialParser parser = new PartialParser(listener); | 73 PartialParser parser = new PartialParser(listener); |
| 74 compiler.withCurrentElement(unit, () => parser.parseUnit(tokens)); | 74 compiler.withCurrentElement(unit, () => parser.parseUnit(tokens)); |
| 75 return unit.topLevelElements; | 75 return unit.localMembers; |
| 76 } | 76 } |
| 77 | 77 |
| 78 // TODO(ahe): We define this method to avoid having to import | 78 // TODO(ahe): We define this method to avoid having to import |
| 79 // the scanner in the tests. We should move SourceString to another | 79 // the scanner in the tests. We should move SourceString to another |
| 80 // location instead. | 80 // location instead. |
| 81 SourceString buildSourceString(String name) { | 81 SourceString buildSourceString(String name) { |
| 82 return new SourceString(name); | 82 return new SourceString(name); |
| 83 } | 83 } |
| OLD | NEW |