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

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

Issue 2521073003: Remove the ability in dart2js to turn off syntax-only generic methods. (Closed)
Patch Set: eernst Created 4 years 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
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/id_generator.dart';
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 {DiagnosticReporter reporter}) { 98 {DiagnosticReporter reporter}) {
99 Token tokens = scan(text); 99 Token tokens = scan(text);
100 if (reporter == null) reporter = new LoggerCanceler(); 100 if (reporter == null) reporter = new LoggerCanceler();
101 Uri uri = new Uri(scheme: "source"); 101 Uri uri = new Uri(scheme: "source");
102 Script script = new Script(uri, uri, new MockFile(text)); 102 Script script = new Script(uri, uri, new MockFile(text));
103 LibraryElement library = new LibraryElementX(script); 103 LibraryElement library = new LibraryElementX(script);
104 NodeListener listener = new NodeListener( 104 NodeListener listener = new NodeListener(
105 new ScannerOptions(canUseNative: true), 105 new ScannerOptions(canUseNative: true),
106 reporter, 106 reporter,
107 library.entryCompilationUnit); 107 library.entryCompilationUnit);
108 Parser parser = new Parser(listener, new MockParserOptions()); 108 Parser parser = new Parser(listener);
109 Token endToken = parseMethod(parser, tokens); 109 Token endToken = parseMethod(parser, tokens);
110 assert(endToken.kind == EOF_TOKEN); 110 assert(endToken.kind == EOF_TOKEN);
111 Node node = listener.popNode(); 111 Node node = listener.popNode();
112 Expect.isNotNull(node); 112 Expect.isNotNull(node);
113 Expect.isTrue(listener.nodes.isEmpty, 'Not empty: ${listener.nodes}'); 113 Expect.isTrue(listener.nodes.isEmpty, 'Not empty: ${listener.nodes}');
114 return node; 114 return node;
115 } 115 }
116 116
117 Node parseStatement(String text) => 117 Node parseStatement(String text) =>
118 parseBodyCode(text, (parser, tokens) => parser.parseStatement(tokens)); 118 parseBodyCode(text, (parser, tokens) => parser.parseStatement(tokens));
(...skipping 24 matching lines...) Expand all
143 registerSource(uri, text); 143 registerSource(uri, text);
144 } 144 }
145 var script = new Script(uri, uri, new MockFile(text)); 145 var script = new Script(uri, uri, new MockFile(text));
146 var unit = new CompilationUnitElementX(script, library); 146 var unit = new CompilationUnitElementX(script, library);
147 DiagnosticReporter reporter = compiler.reporter; 147 DiagnosticReporter reporter = compiler.reporter;
148 ElementListener listener = new ElementListener( 148 ElementListener listener = new ElementListener(
149 compiler.parsingContext.getScannerOptionsFor(library), 149 compiler.parsingContext.getScannerOptionsFor(library),
150 reporter, 150 reporter,
151 unit, 151 unit,
152 new IdGenerator()); 152 new IdGenerator());
153 PartialParser parser = new PartialParser(listener, new MockParserOptions()); 153 PartialParser parser = new PartialParser(listener);
154 reporter.withCurrentElement(unit, () => parser.parseUnit(tokens)); 154 reporter.withCurrentElement(unit, () => parser.parseUnit(tokens));
155 return unit.localMembers; 155 return unit.localMembers;
156 } 156 }
157 157
158 NodeList fullParseUnit(String source, {DiagnosticReporter reporter}) { 158 NodeList fullParseUnit(String source, {DiagnosticReporter reporter}) {
159 return parseBodyCode(source, (parser, tokens) => parser.parseUnit(tokens), 159 return parseBodyCode(source, (parser, tokens) => parser.parseUnit(tokens),
160 reporter: reporter); 160 reporter: reporter);
161 } 161 }
OLDNEW
« no previous file with comments | « tests/compiler/dart2js/options_helper.dart ('k') | tests/compiler/dart2js/partial_parser_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698