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

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

Issue 2936233003: Remove Compiler.mainApp and Compiler.mainFunction (Closed)
Patch Set: Created 3 years, 6 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/mock_compiler.dart ('k') | tests/compiler/dart2js/parser_helper.dart » ('j') | 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) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, 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 import 'dart:async'; 5 import 'dart:async';
6 import 'package:async_helper/async_helper.dart'; 6 import 'package:async_helper/async_helper.dart';
7 import 'package:compiler/src/common_elements.dart'; 7 import 'package:compiler/src/common_elements.dart';
8 import 'package:compiler/src/compiler.dart'; 8 import 'package:compiler/src/compiler.dart';
9 import 'package:compiler/src/elements/entities.dart'; 9 import 'package:compiler/src/elements/entities.dart';
10 import 'package:compiler/src/js_backend/no_such_method_registry.dart'; 10 import 'package:compiler/src/js_backend/no_such_method_registry.dart';
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after
272 compiler.frontendStrategy.elementEnvironment; 272 compiler.frontendStrategy.elementEnvironment;
273 NoSuchMethodRegistry registry = compiler.backend.noSuchMethodRegistry; 273 NoSuchMethodRegistry registry = compiler.backend.noSuchMethodRegistry;
274 NoSuchMethodResolver resolver = registry.internalResolverForTesting; 274 NoSuchMethodResolver resolver = registry.internalResolverForTesting;
275 FunctionEntity ObjectNSM = elementEnvironment.lookupClassMember( 275 FunctionEntity ObjectNSM = elementEnvironment.lookupClassMember(
276 compiler.frontendStrategy.commonElements.objectClass, 'noSuchMethod'); 276 compiler.frontendStrategy.commonElements.objectClass, 'noSuchMethod');
277 ClosedWorld closedWorld = 277 ClosedWorld closedWorld =
278 compiler.resolutionWorldBuilder.closedWorldForTesting; 278 compiler.resolutionWorldBuilder.closedWorldForTesting;
279 279
280 // Test [NoSuchMethodResolver] results for each method. 280 // Test [NoSuchMethodResolver] results for each method.
281 for (NoSuchMethodInfo info in test.methods) { 281 for (NoSuchMethodInfo info in test.methods) {
282 ClassEntity cls = 282 ClassEntity cls = elementEnvironment.lookupClass(
283 elementEnvironment.lookupClass(compiler.mainApp, info.className); 283 elementEnvironment.mainLibrary, info.className);
284 Expect.isNotNull(cls, "Class ${info.className} not found."); 284 Expect.isNotNull(cls, "Class ${info.className} not found.");
285 FunctionEntity noSuchMethod = 285 FunctionEntity noSuchMethod =
286 elementEnvironment.lookupClassMember(cls, 'noSuchMethod'); 286 elementEnvironment.lookupClassMember(cls, 'noSuchMethod');
287 Expect.isNotNull(noSuchMethod, "noSuchMethod not found in $cls."); 287 Expect.isNotNull(noSuchMethod, "noSuchMethod not found in $cls.");
288 288
289 if (info.superClassName == null) { 289 if (info.superClassName == null) {
290 Expect.equals(ObjectNSM, resolver.getSuperNoSuchMethod(noSuchMethod)); 290 Expect.equals(ObjectNSM, resolver.getSuperNoSuchMethod(noSuchMethod));
291 } else { 291 } else {
292 ClassEntity superclass = 292 ClassEntity superclass = elementEnvironment.lookupClass(
293 elementEnvironment.lookupClass(compiler.mainApp, info.superClassName); 293 elementEnvironment.mainLibrary, info.superClassName);
294 Expect.isNotNull( 294 Expect.isNotNull(
295 superclass, "Superclass ${info.superClassName} not found."); 295 superclass, "Superclass ${info.superClassName} not found.");
296 FunctionEntity superNoSuchMethod = 296 FunctionEntity superNoSuchMethod =
297 elementEnvironment.lookupClassMember(superclass, 'noSuchMethod'); 297 elementEnvironment.lookupClassMember(superclass, 'noSuchMethod');
298 Expect.isNotNull( 298 Expect.isNotNull(
299 superNoSuchMethod, "noSuchMethod not found in $superclass."); 299 superNoSuchMethod, "noSuchMethod not found in $superclass.");
300 Expect.equals( 300 Expect.equals(
301 superNoSuchMethod, 301 superNoSuchMethod,
302 resolver.getSuperNoSuchMethod(noSuchMethod), 302 resolver.getSuperNoSuchMethod(noSuchMethod),
303 "Unexpected super noSuchMethod for $noSuchMethod."); 303 "Unexpected super noSuchMethod for $noSuchMethod.");
304 } 304 }
305 305
306 Expect.equals( 306 Expect.equals(
307 info.hasForwardingSyntax, 307 info.hasForwardingSyntax,
308 resolver.hasForwardingSyntax(noSuchMethod), 308 resolver.hasForwardingSyntax(noSuchMethod),
309 "Unexpected hasForwardSyntax result on $noSuchMethod."); 309 "Unexpected hasForwardSyntax result on $noSuchMethod.");
310 Expect.equals( 310 Expect.equals(
311 info.hasThrowingSyntax, 311 info.hasThrowingSyntax,
312 resolver.hasThrowingSyntax(noSuchMethod), 312 resolver.hasThrowingSyntax(noSuchMethod),
313 "Unexpected hasThrowingSyntax result on $noSuchMethod."); 313 "Unexpected hasThrowingSyntax result on $noSuchMethod.");
314 } 314 }
315 315
316 // Test [NoSuchMethodRegistry] results for each method. These are based on 316 // Test [NoSuchMethodRegistry] results for each method. These are based on
317 // the [NoSuchMethodResolver] results which are therefore tested for all 317 // the [NoSuchMethodResolver] results which are therefore tested for all
318 // methods first. 318 // methods first.
319 for (NoSuchMethodInfo info in test.methods) { 319 for (NoSuchMethodInfo info in test.methods) {
320 ClassEntity cls = 320 ClassEntity cls = elementEnvironment.lookupClass(
321 elementEnvironment.lookupClass(compiler.mainApp, info.className); 321 elementEnvironment.mainLibrary, info.className);
322 Expect.isNotNull(cls, "Class ${info.className} not found."); 322 Expect.isNotNull(cls, "Class ${info.className} not found.");
323 FunctionEntity noSuchMethod = 323 FunctionEntity noSuchMethod =
324 elementEnvironment.lookupClassMember(cls, 'noSuchMethod'); 324 elementEnvironment.lookupClassMember(cls, 'noSuchMethod');
325 Expect.isNotNull(noSuchMethod, "noSuchMethod not found in $cls."); 325 Expect.isNotNull(noSuchMethod, "noSuchMethod not found in $cls.");
326 326
327 Expect.equals(info.isDefault, registry.defaultImpls.contains(noSuchMethod), 327 Expect.equals(info.isDefault, registry.defaultImpls.contains(noSuchMethod),
328 "Unexpected isDefault result on $noSuchMethod."); 328 "Unexpected isDefault result on $noSuchMethod.");
329 Expect.equals( 329 Expect.equals(
330 info.isThrowing, 330 info.isThrowing,
331 registry.throwingImpls.contains(noSuchMethod), 331 registry.throwingImpls.contains(noSuchMethod),
(...skipping 14 matching lines...) Expand all
346 registry.complexReturningImpls.contains(noSuchMethod), 346 registry.complexReturningImpls.contains(noSuchMethod),
347 "Unexpected isComplexReturn result on $noSuchMethod."); 347 "Unexpected isComplexReturn result on $noSuchMethod.");
348 } 348 }
349 } 349 }
350 350
351 Expect.equals( 351 Expect.equals(
352 test.isNoSuchMethodUsed, 352 test.isNoSuchMethodUsed,
353 closedWorld.backendUsage.isNoSuchMethodUsed, 353 closedWorld.backendUsage.isNoSuchMethodUsed,
354 "Unexpected isNoSuchMethodUsed result."); 354 "Unexpected isNoSuchMethodUsed result.");
355 } 355 }
OLDNEW
« no previous file with comments | « tests/compiler/dart2js/mock_compiler.dart ('k') | tests/compiler/dart2js/parser_helper.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698