| 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 'dart:async'; | 5 import 'dart:async'; |
| 6 import 'dart:collection'; | 6 import 'dart:collection'; |
| 7 | 7 |
| 8 import 'package:async_helper/async_helper.dart'; | 8 import 'package:async_helper/async_helper.dart'; |
| 9 import 'package:expect/expect.dart'; | 9 import 'package:expect/expect.dart'; |
| 10 import 'package:compiler/src/constants/expressions.dart'; | 10 import 'package:compiler/src/constants/expressions.dart'; |
| (...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 241 | 241 |
| 242 Future testSwitch() { | 242 Future testSwitch() { |
| 243 return MockCompiler.create((MockCompiler compiler) { | 243 return MockCompiler.create((MockCompiler compiler) { |
| 244 compiler.parseScript("class Foo { foo() {" | 244 compiler.parseScript("class Foo { foo() {" |
| 245 "switch (null) { case '': break; case 2: break; } } }"); | 245 "switch (null) { case '': break; case 2: break; } } }"); |
| 246 compiler.resolveStatement("Foo foo;"); | 246 compiler.resolveStatement("Foo foo;"); |
| 247 ClassElement fooElement = compiler.mainApp.find("Foo"); | 247 ClassElement fooElement = compiler.mainApp.find("Foo"); |
| 248 FunctionElement funElement = fooElement.lookupLocalMember("foo"); | 248 FunctionElement funElement = fooElement.lookupLocalMember("foo"); |
| 249 compiler.enqueuer.resolution.applyImpact(new WorldImpactBuilderImpl() | 249 compiler.enqueuer.resolution.applyImpact(new WorldImpactBuilderImpl() |
| 250 ..registerStaticUse(new StaticUse.foreignUse(funElement))); | 250 ..registerStaticUse(new StaticUse.foreignUse(funElement))); |
| 251 compiler.processQueue(compiler.enqueuer.resolution, null); | 251 compiler.processQueue( |
| 252 compiler.enqueuer.resolution, null, compiler.libraryLoader.libraries); |
| 252 DiagnosticCollector collector = compiler.diagnosticCollector; | 253 DiagnosticCollector collector = compiler.diagnosticCollector; |
| 253 Expect.equals(0, collector.warnings.length); | 254 Expect.equals(0, collector.warnings.length); |
| 254 Expect.equals(1, collector.errors.length); | 255 Expect.equals(1, collector.errors.length); |
| 255 Expect.equals(MessageKind.SWITCH_CASE_TYPES_NOT_EQUAL, | 256 Expect.equals(MessageKind.SWITCH_CASE_TYPES_NOT_EQUAL, |
| 256 collector.errors.first.message.kind); | 257 collector.errors.first.message.kind); |
| 257 Expect.equals(2, collector.infos.length); | 258 Expect.equals(2, collector.infos.length); |
| 258 Expect.equals(MessageKind.SWITCH_CASE_TYPES_NOT_EQUAL_CASE, | 259 Expect.equals(MessageKind.SWITCH_CASE_TYPES_NOT_EQUAL_CASE, |
| 259 collector.infos.first.message.kind); | 260 collector.infos.first.message.kind); |
| 260 Expect.equals(MessageKind.SWITCH_CASE_TYPES_NOT_EQUAL_CASE, | 261 Expect.equals(MessageKind.SWITCH_CASE_TYPES_NOT_EQUAL_CASE, |
| 261 collector.infos.elementAt(1).message.kind); | 262 collector.infos.elementAt(1).message.kind); |
| (...skipping 1275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1537 functionName: 'm'); | 1538 functionName: 'm'); |
| 1538 check( | 1539 check( |
| 1539 ''' | 1540 ''' |
| 1540 class A { | 1541 class A { |
| 1541 m() => () => await - 3; | 1542 m() => () => await - 3; |
| 1542 } | 1543 } |
| 1543 main() => new A().m(); | 1544 main() => new A().m(); |
| 1544 ''', | 1545 ''', |
| 1545 className: 'A'); | 1546 className: 'A'); |
| 1546 } | 1547 } |
| OLD | NEW |