| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 'package:async_helper/async_helper.dart'; | 6 import 'package:async_helper/async_helper.dart'; |
| 7 import 'compiler_helper.dart'; | 7 import 'compiler_helper.dart'; |
| 8 import 'package:compiler/src/resolution/class_members.dart' | 8 import 'package:compiler/src/resolution/class_members.dart' |
| 9 show MembersCreator; | 9 show MembersCreator; |
| 10 | 10 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 Future check(String source, {errors, warnings, hints, infos}) { | 27 Future check(String source, {errors, warnings, hints, infos}) { |
| 28 return MockCompiler.create((MockCompiler compiler) { | 28 return MockCompiler.create((MockCompiler compiler) { |
| 29 compiler.diagnosticHandler = createHandler(compiler, source); | 29 compiler.diagnosticHandler = createHandler(compiler, source); |
| 30 compiler.parseScript(source); | 30 compiler.parseScript(source); |
| 31 var cls = compiler.mainApp.find('Class'); | 31 var cls = compiler.mainApp.find('Class'); |
| 32 cls.ensureResolved(compiler.resolution); | 32 cls.ensureResolved(compiler.resolution); |
| 33 MembersCreator.computeAllClassMembers(compiler, cls); | 33 MembersCreator.computeAllClassMembers(compiler, cls); |
| 34 | 34 |
| 35 toList(o) => o == null ? [] : o is List ? o : [o]; | 35 toList(o) => o == null ? [] : o is List ? o : [o]; |
| 36 | 36 |
| 37 compareMessageKinds(source, toList(errors), compiler.errors, 'error'); | 37 compareMessageKinds( |
| 38 source, toList(errors), |
| 39 compiler.diagnosticCollector.errors, 'error'); |
| 38 | 40 |
| 39 compareMessageKinds(source, toList(warnings), compiler.warnings, 'warning'); | 41 compareMessageKinds( |
| 42 source, toList(warnings), |
| 43 compiler.diagnosticCollector.warnings, 'warning'); |
| 40 | 44 |
| 41 if (infos != null) { | 45 if (infos != null) { |
| 42 compareMessageKinds(source, toList(infos), compiler.infos, 'info'); | 46 compareMessageKinds( |
| 47 source, toList(infos), |
| 48 compiler.diagnosticCollector.infos, 'info'); |
| 43 } | 49 } |
| 44 | 50 |
| 45 if (hints != null) { | 51 if (hints != null) { |
| 46 compareMessageKinds(source, toList(hints), compiler.hints, 'hint'); | 52 compareMessageKinds( |
| 53 source, toList(hints), |
| 54 compiler.diagnosticCollector.hints, 'hint'); |
| 47 } | 55 } |
| 48 }); | 56 }); |
| 49 } | 57 } |
| 50 | 58 |
| 51 Future testRequiredParameters() { | 59 Future testRequiredParameters() { |
| 52 return Future.wait([ | 60 return Future.wait([ |
| 53 check(""" | 61 check(""" |
| 54 class A { | 62 class A { |
| 55 method() => null; // testRequiredParameters:0 | 63 method() => null; // testRequiredParameters:0 |
| 56 } | 64 } |
| (...skipping 1480 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1537 class A { | 1545 class A { |
| 1538 noSuchMethod(_) => null; | 1546 noSuchMethod(_) => null; |
| 1539 method(); // testNoSuchMethod:13 | 1547 method(); // testNoSuchMethod:13 |
| 1540 } | 1548 } |
| 1541 class Class extends A { | 1549 class Class extends A { |
| 1542 } | 1550 } |
| 1543 """, warnings: MessageKind.UNIMPLEMENTED_METHOD_ONE, | 1551 """, warnings: MessageKind.UNIMPLEMENTED_METHOD_ONE, |
| 1544 infos: MessageKind.UNIMPLEMENTED_METHOD_CONT), | 1552 infos: MessageKind.UNIMPLEMENTED_METHOD_CONT), |
| 1545 ]); | 1553 ]); |
| 1546 } | 1554 } |
| OLD | NEW |