OLD | NEW |
1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2017, 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:compiler/src/common.dart'; | 5 import 'package:compiler/src/common.dart'; |
6 import 'package:compiler/src/common_elements.dart'; | 6 import 'package:compiler/src/common_elements.dart'; |
7 import 'package:compiler/src/compiler.dart'; | 7 import 'package:compiler/src/compiler.dart'; |
8 import 'package:compiler/src/elements/elements.dart'; | 8 import 'package:compiler/src/elements/elements.dart'; |
9 import 'package:compiler/src/elements/entities.dart'; | 9 import 'package:compiler/src/elements/entities.dart'; |
10 import 'package:compiler/src/resolution/tree_elements.dart'; | 10 import 'package:compiler/src/resolution/tree_elements.dart'; |
(...skipping 13 matching lines...) Expand all Loading... |
24 /// annotation. Any [Id] left in the map will be reported as missing. | 24 /// annotation. Any [Id] left in the map will be reported as missing. |
25 checkCode(String annotatedCode, CheckMemberFunction checkMember, | 25 checkCode(String annotatedCode, CheckMemberFunction checkMember, |
26 {List<String> options: const <String>[]}) async { | 26 {List<String> options: const <String>[]}) async { |
27 AnnotatedCode code = new AnnotatedCode.fromText(annotatedCode, '/*', '*/'); | 27 AnnotatedCode code = new AnnotatedCode.fromText(annotatedCode, '/*', '*/'); |
28 Map<Id, String> expectedMap = computeExpectedMap(code); | 28 Map<Id, String> expectedMap = computeExpectedMap(code); |
29 Compiler compiler = compilerFor( | 29 Compiler compiler = compilerFor( |
30 memorySourceFiles: {'main.dart': code.sourceCode}, options: options); | 30 memorySourceFiles: {'main.dart': code.sourceCode}, options: options); |
31 compiler.stopAfterTypeInference = true; | 31 compiler.stopAfterTypeInference = true; |
32 Uri mainUri = Uri.parse('memory:main.dart'); | 32 Uri mainUri = Uri.parse('memory:main.dart'); |
33 await compiler.run(mainUri); | 33 await compiler.run(mainUri); |
34 LibraryElement mainApp = compiler.mainApp; | 34 LibraryElement mainApp = |
| 35 compiler.frontendStrategy.elementEnvironment.mainLibrary; |
35 mainApp.forEachLocalMember((member) { | 36 mainApp.forEachLocalMember((member) { |
36 if (member.isClass) { | 37 if (member.isClass) { |
37 member.forEachLocalMember((member) { | 38 member.forEachLocalMember((member) { |
38 checkMember(compiler, expectedMap, member); | 39 checkMember(compiler, expectedMap, member); |
39 }); | 40 }); |
40 } else if (member.isTypedef) { | 41 } else if (member.isTypedef) { |
41 // Skip. | 42 // Skip. |
42 } else { | 43 } else { |
43 checkMember(compiler, expectedMap, member); | 44 checkMember(compiler, expectedMap, member); |
44 } | 45 } |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 visitSend(Send node) { | 174 visitSend(Send node) { |
174 checkSend(node); | 175 checkSend(node); |
175 visitNode(node); | 176 visitNode(node); |
176 } | 177 } |
177 | 178 |
178 visitSendSet(SendSet node) { | 179 visitSendSet(SendSet node) { |
179 checkSend(node); | 180 checkSend(node); |
180 visitNode(node); | 181 visitNode(node); |
181 } | 182 } |
182 } | 183 } |
OLD | NEW |