| OLD | NEW |
| 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 library related_types.test; | 5 library related_types.test; |
| 6 | 6 |
| 7 import 'package:async_helper/async_helper.dart'; | 7 import 'package:async_helper/async_helper.dart'; |
| 8 import 'package:expect/expect.dart'; | 8 import 'package:expect/expect.dart'; |
| 9 import 'package:compiler/src/commandline_options.dart'; | 9 import 'package:compiler/src/commandline_options.dart'; |
| 10 import 'package:compiler/src/compiler.dart'; | 10 import 'package:compiler/src/compiler.dart'; |
| (...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 260 main(List<String> arguments) { | 260 main(List<String> arguments) { |
| 261 asyncTest(() async { | 261 asyncTest(() async { |
| 262 DiagnosticCollector collector = new DiagnosticCollector(); | 262 DiagnosticCollector collector = new DiagnosticCollector(); |
| 263 CompilationResult result = await runCompiler( | 263 CompilationResult result = await runCompiler( |
| 264 memorySourceFiles: {'main.dart': CODE}, | 264 memorySourceFiles: {'main.dart': CODE}, |
| 265 options: [Flags.analyzeOnly, Flags.analyzeMain], | 265 options: [Flags.analyzeOnly, Flags.analyzeMain], |
| 266 diagnosticHandler: collector); | 266 diagnosticHandler: collector); |
| 267 Expect.isFalse( | 267 Expect.isFalse( |
| 268 collector.hasRegularMessages, "Unexpected analysis messages."); | 268 collector.hasRegularMessages, "Unexpected analysis messages."); |
| 269 Compiler compiler = result.compiler; | 269 Compiler compiler = result.compiler; |
| 270 compiler.openWorld.closeWorld(); | 270 compiler.openWorld.closeWorld(compiler.reporter); |
| 271 | 271 |
| 272 void checkMember(MemberElement member) { | 272 void checkMember(MemberElement member) { |
| 273 if (!member.name.startsWith('test_')) return; | 273 if (!member.name.startsWith('test_')) return; |
| 274 | 274 |
| 275 collector.clear(); | 275 collector.clear(); |
| 276 checkMemberElement(compiler, member); | 276 checkMemberElement(compiler, member); |
| 277 Expect.equals( | 277 Expect.equals( |
| 278 1, collector.hints.length, "Unexpected hint count for $member."); | 278 1, collector.hints.length, "Unexpected hint count for $member."); |
| 279 Expect.equals( | 279 Expect.equals( |
| 280 MessageKind.NO_COMMON_SUBTYPES, | 280 MessageKind.NO_COMMON_SUBTYPES, |
| 281 collector.hints.first.message.kind, | 281 collector.hints.first.message.kind, |
| 282 "Unexpected message kind ${collector.hints.first.message.kind} " | 282 "Unexpected message kind ${collector.hints.first.message.kind} " |
| 283 "for $member."); | 283 "for $member."); |
| 284 } | 284 } |
| 285 | 285 |
| 286 compiler.mainApp.forEachLocalMember((Element element) { | 286 compiler.mainApp.forEachLocalMember((Element element) { |
| 287 if (element.isClass) { | 287 if (element.isClass) { |
| 288 ClassElement cls = element; | 288 ClassElement cls = element; |
| 289 cls.forEachLocalMember(checkMember); | 289 cls.forEachLocalMember(checkMember); |
| 290 } else { | 290 } else { |
| 291 checkMember(element); | 291 checkMember(element); |
| 292 } | 292 } |
| 293 }); | 293 }); |
| 294 }); | 294 }); |
| 295 } | 295 } |
| OLD | NEW |