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

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

Issue 2846433003: Run closed_world2_test using the normal compiler pipeline. (Closed)
Patch Set: Updated cf. comments Created 3 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
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 mock_compiler; 5 library mock_compiler;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:collection'; 8 import 'dart:collection';
9 9
10 import 'package:compiler/compiler_new.dart' as api; 10 import 'package:compiler/compiler_new.dart' as api;
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 diagnosticHandler.report(message.message, uri, begin, end, text, kind); 202 diagnosticHandler.report(message.message, uri, begin, end, text, kind);
203 } 203 }
204 } 204 }
205 205
206 processMessage(message, kind); 206 processMessage(message, kind);
207 infoMessages.forEach((i) => processMessage(i, api.Diagnostic.INFO)); 207 infoMessages.forEach((i) => processMessage(i, api.Diagnostic.INFO));
208 } 208 }
209 209
210 CollectingTreeElements resolveStatement(String text) { 210 CollectingTreeElements resolveStatement(String text) {
211 parsedTree = parseStatement(text); 211 parsedTree = parseStatement(text);
212 return resolveNodeStatement(parsedTree, new MockElement(mainApp)); 212 LibraryElement library = mainApp;
213 return resolveNodeStatement(parsedTree, new MockElement(library));
213 } 214 }
214 215
215 TreeElementMapping resolveNodeStatement( 216 TreeElementMapping resolveNodeStatement(
216 Node tree, ExecutableElement element) { 217 Node tree, ExecutableElement element) {
217 ResolverVisitor visitor = new ResolverVisitor( 218 ResolverVisitor visitor = new ResolverVisitor(
218 this.resolution, 219 this.resolution,
219 element, 220 element,
220 new ResolutionRegistry( 221 new ResolutionRegistry(
221 this.backend.target, new CollectingTreeElements(element)), 222 this.backend.target, new CollectingTreeElements(element)),
222 scope: 223 scope:
223 new MockTypeVariablesScope(element.enclosingElement.buildScope())); 224 new MockTypeVariablesScope(element.enclosingElement.buildScope()));
224 if (visitor.scope is LibraryScope || 225 if (visitor.scope is LibraryScope ||
225 visitor.scope is MockTypeVariablesScope) { 226 visitor.scope is MockTypeVariablesScope) {
226 visitor.scope = new MethodScope(visitor.scope, element); 227 visitor.scope = new MethodScope(visitor.scope, element);
227 } 228 }
228 visitor.visit(tree); 229 visitor.visit(tree);
229 visitor.scope = new LibraryScope(element.library); 230 visitor.scope = new LibraryScope(element.library);
230 return visitor.registry.mapping; 231 return visitor.registry.mapping;
231 } 232 }
232 233
233 resolverVisitor() { 234 resolverVisitor() {
234 Element mockElement = new MockElement(mainApp.entryCompilationUnit); 235 LibraryElement library = mainApp;
236 Element mockElement = new MockElement(library.entryCompilationUnit);
235 ResolverVisitor visitor = new ResolverVisitor( 237 ResolverVisitor visitor = new ResolverVisitor(
236 this.resolution, 238 this.resolution,
237 mockElement, 239 mockElement,
238 new ResolutionRegistry( 240 new ResolutionRegistry(
239 this.backend.target, new CollectingTreeElements(mockElement)), 241 this.backend.target, new CollectingTreeElements(mockElement)),
240 scope: mockElement.enclosingElement.buildScope()); 242 scope: mockElement.enclosingElement.buildScope());
241 visitor.scope = new MethodScope(visitor.scope, mockElement); 243 visitor.scope = new MethodScope(visitor.scope, mockElement);
242 return visitor; 244 return visitor;
243 } 245 }
244 246
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
390 trustTypeAnnotations: trustTypeAnnotations, 392 trustTypeAnnotations: trustTypeAnnotations,
391 enableTypeAssertions: enableTypeAssertions, 393 enableTypeAssertions: enableTypeAssertions,
392 enableUserAssertions: enableUserAssertions, 394 enableUserAssertions: enableUserAssertions,
393 expectedErrors: expectedErrors, 395 expectedErrors: expectedErrors,
394 expectedWarnings: expectedWarnings, 396 expectedWarnings: expectedWarnings,
395 outputProvider: outputProvider); 397 outputProvider: outputProvider);
396 compiler.registerSource(uri, code); 398 compiler.registerSource(uri, code);
397 compiler.diagnosticHandler = createHandler(compiler, code); 399 compiler.diagnosticHandler = createHandler(compiler, code);
398 return compiler; 400 return compiler;
399 } 401 }
OLDNEW
« no previous file with comments | « tests/compiler/dart2js/kernel/helper.dart ('k') | tests/compiler/dart2js/override_inheritance_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698