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 "package:async_helper/async_helper.dart"; | 7 import "package:async_helper/async_helper.dart"; |
8 import '../mock_compiler.dart'; | 8 import '../mock_compiler.dart'; |
9 import '../mock_libraries.dart'; | 9 import '../mock_libraries.dart'; |
10 import '../output_collector.dart'; | 10 import '../output_collector.dart'; |
11 import 'package:compiler/compiler.dart'; | 11 import 'package:compiler/compiler.dart'; |
12 import 'package:compiler/src/compiler.dart' as leg; | 12 import 'package:compiler/src/common/names.dart' show Identifiers; |
13 import 'package:compiler/src/dart_backend/dart_backend.dart'; | 13 import 'package:compiler/src/dart_backend/dart_backend.dart'; |
14 import 'package:compiler/src/elements/elements.dart'; | 14 import 'package:compiler/src/elements/elements.dart'; |
15 import 'package:compiler/src/tree/tree.dart'; | 15 import 'package:compiler/src/tree/tree.dart'; |
16 | 16 |
17 const ioLib = r''' | 17 const ioLib = r''' |
18 library io; | 18 library io; |
19 class Platform { | 19 class Platform { |
20 static int operatingSystem; | 20 static int operatingSystem; |
21 } | 21 } |
22 '''; | 22 '''; |
(...skipping 603 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
626 var src = ''' | 626 var src = ''' |
627 main() { | 627 main() { |
628 function localfoo() {} | 628 function localfoo() {} |
629 localfoo(); | 629 localfoo(); |
630 } | 630 } |
631 '''; | 631 '''; |
632 MockCompiler compiler = new MockCompiler.internal(emitJavaScript: false); | 632 MockCompiler compiler = new MockCompiler.internal(emitJavaScript: false); |
633 asyncTest(() => compiler.init().then((_) { | 633 asyncTest(() => compiler.init().then((_) { |
634 assert(compiler.backend is DartBackend); | 634 assert(compiler.backend is DartBackend); |
635 compiler.parseScript(src); | 635 compiler.parseScript(src); |
636 FunctionElement mainElement = compiler.mainApp.find(leg.Compiler.MAIN); | 636 FunctionElement mainElement = compiler.mainApp.find(Identifiers.main); |
637 compiler.processQueue(compiler.enqueuer.resolution, mainElement); | 637 compiler.processQueue(compiler.enqueuer.resolution, mainElement); |
638 PlaceholderCollector collector = collectPlaceholders(compiler, mainElement); | 638 PlaceholderCollector collector = collectPlaceholders(compiler, mainElement); |
639 FunctionExpression mainNode = mainElement.node; | 639 FunctionExpression mainNode = mainElement.node; |
640 Block body = mainNode.body; | 640 Block body = mainNode.body; |
641 FunctionDeclaration functionDeclaration = body.statements.nodes.head; | 641 FunctionDeclaration functionDeclaration = body.statements.nodes.head; |
642 FunctionExpression fooNode = functionDeclaration.function; | 642 FunctionExpression fooNode = functionDeclaration.function; |
643 LocalPlaceholder fooPlaceholder = | 643 LocalPlaceholder fooPlaceholder = |
644 collector.functionScopes[mainElement].localPlaceholders.first; | 644 collector.functionScopes[mainElement].localPlaceholders.first; |
645 Expect.isTrue(fooPlaceholder.nodes.contains(fooNode.name)); | 645 Expect.isTrue(fooPlaceholder.nodes.contains(fooNode.name)); |
646 })); | 646 })); |
(...skipping 460 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1107 testParametersMinified(); | 1107 testParametersMinified(); |
1108 testDeclarationTypePlaceholders(); | 1108 testDeclarationTypePlaceholders(); |
1109 testPlatformLibraryMemberNamesAreFixed(); | 1109 testPlatformLibraryMemberNamesAreFixed(); |
1110 testConflictsWithCoreLib(); | 1110 testConflictsWithCoreLib(); |
1111 testUnresolvedNamedConstructor1(); | 1111 testUnresolvedNamedConstructor1(); |
1112 testUnresolvedNamedConstructor2(); | 1112 testUnresolvedNamedConstructor2(); |
1113 testUnresolvedNamedConstructor3(); | 1113 testUnresolvedNamedConstructor3(); |
1114 testClassAndNamedMixinDeclarations(); | 1114 testClassAndNamedMixinDeclarations(); |
1115 } | 1115 } |
1116 | 1116 |
OLD | NEW |