| 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 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 249 Future testSwitch() { | 249 Future testSwitch() { |
| 250 return MockCompiler.create((MockCompiler compiler) { | 250 return MockCompiler.create((MockCompiler compiler) { |
| 251 compiler.parseScript("class Foo { foo() {" | 251 compiler.parseScript("class Foo { foo() {" |
| 252 "switch (null) { case '': break; case 2: break; } } }"); | 252 "switch (null) { case '': break; case 2: break; } } }"); |
| 253 compiler.resolveStatement("Foo foo;"); | 253 compiler.resolveStatement("Foo foo;"); |
| 254 LibraryElement mainApp = compiler.mainApp; | 254 LibraryElement mainApp = compiler.mainApp; |
| 255 ClassElement fooElement = mainApp.find("Foo"); | 255 ClassElement fooElement = mainApp.find("Foo"); |
| 256 MethodElement funElement = fooElement.lookupLocalMember("foo"); | 256 MethodElement funElement = fooElement.lookupLocalMember("foo"); |
| 257 compiler.enqueuer.resolution.applyImpact(new WorldImpactBuilderImpl() | 257 compiler.enqueuer.resolution.applyImpact(new WorldImpactBuilderImpl() |
| 258 ..registerStaticUse(new StaticUse.implicitInvoke(funElement))); | 258 ..registerStaticUse(new StaticUse.implicitInvoke(funElement))); |
| 259 compiler.processQueue( | 259 compiler.processQueue(compiler.frontendStrategy.elementEnvironment, |
| 260 compiler.enqueuer.resolution, null, compiler.libraryLoader.libraries); | 260 compiler.enqueuer.resolution, null, compiler.libraryLoader.libraries); |
| 261 DiagnosticCollector collector = compiler.diagnosticCollector; | 261 DiagnosticCollector collector = compiler.diagnosticCollector; |
| 262 Expect.equals(0, collector.warnings.length); | 262 Expect.equals(0, collector.warnings.length); |
| 263 Expect.equals(1, collector.errors.length); | 263 Expect.equals(1, collector.errors.length); |
| 264 Expect.equals(MessageKind.SWITCH_CASE_TYPES_NOT_EQUAL, | 264 Expect.equals(MessageKind.SWITCH_CASE_TYPES_NOT_EQUAL, |
| 265 collector.errors.first.message.kind); | 265 collector.errors.first.message.kind); |
| 266 Expect.equals(2, collector.infos.length); | 266 Expect.equals(2, collector.infos.length); |
| 267 Expect.equals(MessageKind.SWITCH_CASE_TYPES_NOT_EQUAL_CASE, | 267 Expect.equals(MessageKind.SWITCH_CASE_TYPES_NOT_EQUAL_CASE, |
| 268 collector.infos.first.message.kind); | 268 collector.infos.first.message.kind); |
| 269 Expect.equals(MessageKind.SWITCH_CASE_TYPES_NOT_EQUAL_CASE, | 269 Expect.equals(MessageKind.SWITCH_CASE_TYPES_NOT_EQUAL_CASE, |
| (...skipping 1298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1568 functionName: 'm'); | 1568 functionName: 'm'); |
| 1569 check( | 1569 check( |
| 1570 ''' | 1570 ''' |
| 1571 class A { | 1571 class A { |
| 1572 m() => () => await - 3; | 1572 m() => () => await - 3; |
| 1573 } | 1573 } |
| 1574 main() => new A().m(); | 1574 main() => new A().m(); |
| 1575 ''', | 1575 ''', |
| 1576 className: 'A'); | 1576 className: 'A'); |
| 1577 } | 1577 } |
| OLD | NEW |