Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(900)

Side by Side Diff: tests/compiler/dart2js/parser_helper.dart

Issue 15301003: Revert r22847: some dart2dart tests fail. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 import "dart:uri"; 8 import "dart:uri";
9 9
10 import "../../../sdk/lib/_internal/compiler/implementation/elements/elements.dar t"; 10 import "../../../sdk/lib/_internal/compiler/implementation/elements/elements.dar t";
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 Node parseMember(String text, {DiagnosticListener diagnosticHandler}) { 71 Node parseMember(String text, {DiagnosticListener diagnosticHandler}) {
72 return parseBodyCode(text, (parser, tokens) => parser.parseMember(tokens), 72 return parseBodyCode(text, (parser, tokens) => parser.parseMember(tokens),
73 diagnosticHandler: diagnosticHandler); 73 diagnosticHandler: diagnosticHandler);
74 } 74 }
75 75
76 class MockFile extends SourceFile { 76 class MockFile extends SourceFile {
77 MockFile(text) 77 MockFile(text)
78 : super('<string>', text); 78 : super('<string>', text);
79 } 79 }
80 80
81 var sourceCounter = 0;
82
83 Link<Element> parseUnit(String text, Compiler compiler, 81 Link<Element> parseUnit(String text, Compiler compiler,
84 LibraryElement library, 82 LibraryElement library) {
85 [void registerSource(Uri uri, String source)]) {
86 Token tokens = scan(text); 83 Token tokens = scan(text);
87 Uri uri = 84 Uri uri = new Uri.fromComponents(scheme: "source");
88 new Uri.fromComponents(scheme: "source", path: '${++sourceCounter}');
89 if (registerSource != null) {
90 registerSource(uri, text);
91 }
92 var script = new Script(uri, new MockFile(text)); 85 var script = new Script(uri, new MockFile(text));
93 var unit = new CompilationUnitElementX(script, library); 86 var unit = new CompilationUnitElementX(script, library);
94 int id = 0; 87 int id = 0;
95 ElementListener listener = new ElementListener(compiler, unit, () => id++); 88 ElementListener listener = new ElementListener(compiler, unit, () => id++);
96 PartialParser parser = new PartialParser(listener); 89 PartialParser parser = new PartialParser(listener);
97 compiler.withCurrentElement(unit, () => parser.parseUnit(tokens)); 90 compiler.withCurrentElement(unit, () => parser.parseUnit(tokens));
98 return unit.localMembers; 91 return unit.localMembers;
99 } 92 }
100 93
101 NodeList fullParseUnit(String source, {DiagnosticListener diagnosticHandler}) { 94 NodeList fullParseUnit(String source, {DiagnosticListener diagnosticHandler}) {
102 return parseBodyCode(source, (parser, tokens) => parser.parseUnit(tokens), 95 return parseBodyCode(source, (parser, tokens) => parser.parseUnit(tokens),
103 diagnosticHandler: diagnosticHandler); 96 diagnosticHandler: diagnosticHandler);
104 } 97 }
105 98
106 // TODO(ahe): We define this method to avoid having to import 99 // TODO(ahe): We define this method to avoid having to import
107 // the scanner in the tests. We should move SourceString to another 100 // the scanner in the tests. We should move SourceString to another
108 // location instead. 101 // location instead.
109 SourceString buildSourceString(String name) { 102 SourceString buildSourceString(String name) {
110 return new SourceString(name); 103 return new SourceString(name);
111 } 104 }
OLDNEW
« no previous file with comments | « tests/compiler/dart2js/mock_compiler.dart ('k') | tests/compiler/dart2js/type_checker_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698