OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 "package:expect/expect.dart"; | 5 import "package:expect/expect.dart"; |
6 import 'dart:async'; | 6 import 'dart:async'; |
7 import 'parser_helper.dart'; | 7 import 'parser_helper.dart'; |
8 import 'mock_compiler.dart'; | 8 import 'mock_compiler.dart'; |
9 import '../../../sdk/lib/_internal/compiler/compiler.dart'; | 9 import '../../../sdk/lib/_internal/compiler/compiler.dart'; |
10 import '../../../sdk/lib/_internal/compiler/implementation/dart2jslib.dart' as l
eg; | 10 import '../../../sdk/lib/_internal/compiler/implementation/dart2jslib.dart' as l
eg; |
(...skipping 436 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
447 new PlaceholderCollector(compiler, new Set<String>(), new DynoMap(compiler)) | 447 new PlaceholderCollector(compiler, new Set<String>(), new DynoMap(compiler)) |
448 ..collect(element); | 448 ..collect(element); |
449 | 449 |
450 testLocalFunctionPlaceholder() { | 450 testLocalFunctionPlaceholder() { |
451 var src = ''' | 451 var src = ''' |
452 main() { | 452 main() { |
453 function localfoo() {} | 453 function localfoo() {} |
454 localfoo(); | 454 localfoo(); |
455 } | 455 } |
456 '''; | 456 '''; |
457 MockCompiler compiler = new MockCompiler(); | 457 MockCompiler compiler = new MockCompiler(emitJavaScript: false); |
| 458 assert(compiler.backend is DartBackend); |
458 compiler.parseScript(src); | 459 compiler.parseScript(src); |
459 FunctionElement mainElement = compiler.mainApp.find(leg.Compiler.MAIN); | 460 FunctionElement mainElement = compiler.mainApp.find(leg.Compiler.MAIN); |
460 compiler.processQueue(compiler.enqueuer.resolution, mainElement); | 461 compiler.processQueue(compiler.enqueuer.resolution, mainElement); |
461 PlaceholderCollector collector = collectPlaceholders(compiler, mainElement); | 462 PlaceholderCollector collector = collectPlaceholders(compiler, mainElement); |
462 FunctionExpression mainNode = mainElement.parseNode(compiler); | 463 FunctionExpression mainNode = mainElement.parseNode(compiler); |
463 FunctionExpression fooNode = mainNode.body.statements.nodes.head.function; | 464 FunctionExpression fooNode = mainNode.body.statements.nodes.head.function; |
464 LocalPlaceholder fooPlaceholder = | 465 LocalPlaceholder fooPlaceholder = |
465 collector.functionScopes[mainElement].localPlaceholders.first; | 466 collector.functionScopes[mainElement].localPlaceholders.first; |
466 Expect.isTrue(fooPlaceholder.nodes.contains(fooNode.name)); | 467 Expect.isTrue(fooPlaceholder.nodes.contains(fooNode.name)); |
467 } | 468 } |
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
725 testStaticAccessIoLib(); | 726 testStaticAccessIoLib(); |
726 testLocalFunctionPlaceholder(); | 727 testLocalFunctionPlaceholder(); |
727 testMinification(); | 728 testMinification(); |
728 testClosureLocalsMinified(); | 729 testClosureLocalsMinified(); |
729 testParametersMinified(); | 730 testParametersMinified(); |
730 testDeclarationTypePlaceholders(); | 731 testDeclarationTypePlaceholders(); |
731 testPlatformLibraryMemberNamesAreFixed(); | 732 testPlatformLibraryMemberNamesAreFixed(); |
732 testConflictsWithCoreLib(); | 733 testConflictsWithCoreLib(); |
733 testUnresolvedNamedConstructor(); | 734 testUnresolvedNamedConstructor(); |
734 } | 735 } |
OLD | NEW |