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

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

Issue 2721403006: Split NativeData (Closed)
Patch Set: Created 3 years, 9 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 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 parsedTree = parseStatement(text); 214 parsedTree = parseStatement(text);
215 return resolveNodeStatement(parsedTree, new MockElement(mainApp)); 215 return resolveNodeStatement(parsedTree, new MockElement(mainApp));
216 } 216 }
217 217
218 TreeElementMapping resolveNodeStatement( 218 TreeElementMapping resolveNodeStatement(
219 Node tree, ExecutableElement element) { 219 Node tree, ExecutableElement element) {
220 ResolverVisitor visitor = new ResolverVisitor( 220 ResolverVisitor visitor = new ResolverVisitor(
221 this.resolution, 221 this.resolution,
222 element, 222 element,
223 new ResolutionRegistry( 223 new ResolutionRegistry(
224 this.backend, new CollectingTreeElements(element)), 224 this.backend.target, new CollectingTreeElements(element)),
225 scope: 225 scope:
226 new MockTypeVariablesScope(element.enclosingElement.buildScope())); 226 new MockTypeVariablesScope(element.enclosingElement.buildScope()));
227 if (visitor.scope is LibraryScope || 227 if (visitor.scope is LibraryScope ||
228 visitor.scope is MockTypeVariablesScope) { 228 visitor.scope is MockTypeVariablesScope) {
229 visitor.scope = new MethodScope(visitor.scope, element); 229 visitor.scope = new MethodScope(visitor.scope, element);
230 } 230 }
231 visitor.visit(tree); 231 visitor.visit(tree);
232 visitor.scope = new LibraryScope(element.library); 232 visitor.scope = new LibraryScope(element.library);
233 return visitor.registry.mapping; 233 return visitor.registry.mapping;
234 } 234 }
235 235
236 resolverVisitor() { 236 resolverVisitor() {
237 Element mockElement = new MockElement(mainApp.entryCompilationUnit); 237 Element mockElement = new MockElement(mainApp.entryCompilationUnit);
238 ResolverVisitor visitor = new ResolverVisitor( 238 ResolverVisitor visitor = new ResolverVisitor(
239 this.resolution, 239 this.resolution,
240 mockElement, 240 mockElement,
241 new ResolutionRegistry( 241 new ResolutionRegistry(
242 this.backend, new CollectingTreeElements(mockElement)), 242 this.backend.target, new CollectingTreeElements(mockElement)),
243 scope: mockElement.enclosingElement.buildScope()); 243 scope: mockElement.enclosingElement.buildScope());
244 visitor.scope = new MethodScope(visitor.scope, mockElement); 244 visitor.scope = new MethodScope(visitor.scope, mockElement);
245 return visitor; 245 return visitor;
246 } 246 }
247 247
248 parseScript(String text, [LibraryElement library]) { 248 parseScript(String text, [LibraryElement library]) {
249 if (library == null) library = mainApp; 249 if (library == null) library = mainApp;
250 parseUnit(text, this, library, registerSource); 250 parseUnit(text, this, library, registerSource);
251 } 251 }
252 252
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
393 trustTypeAnnotations: trustTypeAnnotations, 393 trustTypeAnnotations: trustTypeAnnotations,
394 enableTypeAssertions: enableTypeAssertions, 394 enableTypeAssertions: enableTypeAssertions,
395 enableUserAssertions: enableUserAssertions, 395 enableUserAssertions: enableUserAssertions,
396 expectedErrors: expectedErrors, 396 expectedErrors: expectedErrors,
397 expectedWarnings: expectedWarnings, 397 expectedWarnings: expectedWarnings,
398 outputProvider: outputProvider); 398 outputProvider: outputProvider);
399 compiler.registerSource(uri, code); 399 compiler.registerSource(uri, code);
400 compiler.diagnosticHandler = createHandler(compiler, code); 400 compiler.diagnosticHandler = createHandler(compiler, code);
401 return compiler; 401 return compiler;
402 } 402 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698