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 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
234 }); | 234 }); |
235 } | 235 } |
236 | 236 |
237 Future testSwitch() { | 237 Future testSwitch() { |
238 return MockCompiler.create((MockCompiler compiler) { | 238 return MockCompiler.create((MockCompiler compiler) { |
239 compiler.parseScript("class Foo { foo() {" | 239 compiler.parseScript("class Foo { foo() {" |
240 "switch (null) { case '': break; case 2: break; } } }"); | 240 "switch (null) { case '': break; case 2: break; } } }"); |
241 compiler.resolveStatement("Foo foo;"); | 241 compiler.resolveStatement("Foo foo;"); |
242 ClassElement fooElement = compiler.mainApp.find("Foo"); | 242 ClassElement fooElement = compiler.mainApp.find("Foo"); |
243 FunctionElement funElement = fooElement.lookupLocalMember("foo"); | 243 FunctionElement funElement = fooElement.lookupLocalMember("foo"); |
244 compiler.processQueue(compiler.enqueuer.resolution, funElement); | 244 compiler.enqueuer.resolution.addToWorkList(funElement); |
| 245 compiler.processQueue(compiler.enqueuer.resolution, null); |
245 DiagnosticCollector collector = compiler.diagnosticCollector; | 246 DiagnosticCollector collector = compiler.diagnosticCollector; |
246 Expect.equals(0, collector.warnings.length); | 247 Expect.equals(0, collector.warnings.length); |
247 Expect.equals(1, collector.errors.length); | 248 Expect.equals(1, collector.errors.length); |
248 Expect.equals(MessageKind.SWITCH_CASE_TYPES_NOT_EQUAL, | 249 Expect.equals(MessageKind.SWITCH_CASE_TYPES_NOT_EQUAL, |
249 collector.errors.first.message.kind); | 250 collector.errors.first.message.kind); |
250 Expect.equals(2, collector.infos.length); | 251 Expect.equals(2, collector.infos.length); |
251 Expect.equals(MessageKind.SWITCH_CASE_TYPES_NOT_EQUAL_CASE, | 252 Expect.equals(MessageKind.SWITCH_CASE_TYPES_NOT_EQUAL_CASE, |
252 collector.infos.first.message.kind); | 253 collector.infos.first.message.kind); |
253 Expect.equals(MessageKind.SWITCH_CASE_TYPES_NOT_EQUAL_CASE, | 254 Expect.equals(MessageKind.SWITCH_CASE_TYPES_NOT_EQUAL_CASE, |
254 collector.infos.elementAt(1).message.kind); | 255 collector.infos.elementAt(1).message.kind); |
(...skipping 1275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1530 functionName: 'm'); | 1531 functionName: 'm'); |
1531 check( | 1532 check( |
1532 ''' | 1533 ''' |
1533 class A { | 1534 class A { |
1534 m() => () => await - 3; | 1535 m() => () => await - 3; |
1535 } | 1536 } |
1536 main() => new A().m(); | 1537 main() => new A().m(); |
1537 ''', | 1538 ''', |
1538 className: 'A'); | 1539 className: 'A'); |
1539 } | 1540 } |
OLD | NEW |