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

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

Issue 1867243004: Begin refactoring compiler out of diet parser and scanner (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 8 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
« no previous file with comments | « tests/compiler/dart2js/exit_code_test.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/tree/tree.dart"; 11 import "package:compiler/src/tree/tree.dart";
11 import "package:compiler/src/parser/element_listener.dart"; 12 import "package:compiler/src/parser/element_listener.dart";
12 import "package:compiler/src/parser/node_listener.dart"; 13 import "package:compiler/src/parser/node_listener.dart";
13 import "package:compiler/src/parser/parser.dart"; 14 import "package:compiler/src/parser/parser.dart";
14 import "package:compiler/src/parser/partial_parser.dart"; 15 import "package:compiler/src/parser/partial_parser.dart";
15 import "package:compiler/src/scanner/string_scanner.dart"; 16 import "package:compiler/src/scanner/string_scanner.dart";
16 import "package:compiler/src/tokens/token.dart"; 17 import "package:compiler/src/tokens/token.dart";
17 import "package:compiler/src/tokens/token_constants.dart"; 18 import "package:compiler/src/tokens/token_constants.dart";
18 import "package:compiler/src/io/source_file.dart"; 19 import "package:compiler/src/io/source_file.dart";
19 import "package:compiler/src/util/util.dart"; 20 import "package:compiler/src/util/util.dart";
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 Link<Element> parseUnit(String text, Compiler compiler, 144 Link<Element> parseUnit(String text, Compiler compiler,
144 LibraryElement library, 145 LibraryElement library,
145 [void registerSource(Uri uri, String source)]) { 146 [void registerSource(Uri uri, String source)]) {
146 Token tokens = scan(text); 147 Token tokens = scan(text);
147 Uri uri = new Uri(scheme: "source", path: '${++sourceCounter}'); 148 Uri uri = new Uri(scheme: "source", path: '${++sourceCounter}');
148 if (registerSource != null) { 149 if (registerSource != null) {
149 registerSource(uri, text); 150 registerSource(uri, text);
150 } 151 }
151 var script = new Script(uri, uri, new MockFile(text)); 152 var script = new Script(uri, uri, new MockFile(text));
152 var unit = new CompilationUnitElementX(script, library); 153 var unit = new CompilationUnitElementX(script, library);
153 int id = 0;
154 DiagnosticReporter reporter = compiler.reporter; 154 DiagnosticReporter reporter = compiler.reporter;
155 ElementListener listener = new ElementListener( 155 ElementListener listener = new ElementListener(
156 compiler.parsing.getScannerOptionsFor(library), 156 compiler.parsing.getScannerOptionsFor(library),
157 reporter, unit, () => id++); 157 reporter, unit, new IdGenerator());
158 PartialParser parser = new PartialParser(listener, new MockParserOptions()); 158 PartialParser parser = new PartialParser(listener, new MockParserOptions());
159 reporter.withCurrentElement(unit, () => parser.parseUnit(tokens)); 159 reporter.withCurrentElement(unit, () => parser.parseUnit(tokens));
160 return unit.localMembers; 160 return unit.localMembers;
161 } 161 }
162 162
163 NodeList fullParseUnit(String source, {DiagnosticReporter reporter}) { 163 NodeList fullParseUnit(String source, {DiagnosticReporter reporter}) {
164 return parseBodyCode( 164 return parseBodyCode(
165 source, 165 source,
166 (parser, tokens) => parser.parseUnit(tokens), 166 (parser, tokens) => parser.parseUnit(tokens),
167 reporter: reporter); 167 reporter: reporter);
168 } 168 }
OLDNEW
« no previous file with comments | « tests/compiler/dart2js/exit_code_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698