| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 | 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 | 9 |
| 10 import 'package:compiler/src/elements/resolution_types.dart'; | 10 import 'package:compiler/src/elements/resolution_types.dart'; |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 testAsyncReturn | 68 testAsyncReturn |
| 69 ]; | 69 ]; |
| 70 asyncTest(() => Future.forEach(tests, (test) => setup(test))); | 70 asyncTest(() => Future.forEach(tests, (test) => setup(test))); |
| 71 } | 71 } |
| 72 | 72 |
| 73 testSimpleTypes(MockCompiler compiler) { | 73 testSimpleTypes(MockCompiler compiler) { |
| 74 checkType(ResolutionInterfaceType type, String code) { | 74 checkType(ResolutionInterfaceType type, String code) { |
| 75 Expect.equals(type, analyzeType(compiler, code)); | 75 Expect.equals(type, analyzeType(compiler, code)); |
| 76 } | 76 } |
| 77 | 77 |
| 78 checkType(compiler.commonElements.intType, "3"); | 78 checkType(compiler.resolution.commonElements.intType, "3"); |
| 79 checkType(compiler.commonElements.boolType, "false"); | 79 checkType(compiler.resolution.commonElements.boolType, "false"); |
| 80 checkType(compiler.commonElements.boolType, "true"); | 80 checkType(compiler.resolution.commonElements.boolType, "true"); |
| 81 checkType(compiler.commonElements.stringType, "'hestfisk'"); | 81 checkType(compiler.resolution.commonElements.stringType, "'hestfisk'"); |
| 82 } | 82 } |
| 83 | 83 |
| 84 Future testReturn(MockCompiler compiler) { | 84 Future testReturn(MockCompiler compiler) { |
| 85 Future check(String code, [expectedWarnings]) { | 85 Future check(String code, [expectedWarnings]) { |
| 86 return analyzeTopLevel(code, expectedWarnings); | 86 return analyzeTopLevel(code, expectedWarnings); |
| 87 } | 87 } |
| 88 | 88 |
| 89 return Future.wait([ | 89 return Future.wait([ |
| 90 check("void foo() { return 3; }", MessageKind.RETURN_VALUE_IN_VOID), | 90 check("void foo() { return 3; }", MessageKind.RETURN_VALUE_IN_VOID), |
| 91 check("int bar() { return 'hest'; }", NOT_ASSIGNABLE), | 91 check("int bar() { return 'hest'; }", NOT_ASSIGNABLE), |
| (...skipping 2698 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2790 TreeElements elements = compiler.resolveNodeStatement(node, element); | 2790 TreeElements elements = compiler.resolveNodeStatement(node, element); |
| 2791 TypeCheckerVisitor checker = | 2791 TypeCheckerVisitor checker = |
| 2792 new TypeCheckerVisitor(compiler, elements, compiler.types); | 2792 new TypeCheckerVisitor(compiler, elements, compiler.types); |
| 2793 DiagnosticCollector collector = compiler.diagnosticCollector; | 2793 DiagnosticCollector collector = compiler.diagnosticCollector; |
| 2794 collector.clear(); | 2794 collector.clear(); |
| 2795 checker.analyze(node, mustHaveType: false); | 2795 checker.analyze(node, mustHaveType: false); |
| 2796 generateOutput(compiler, text); | 2796 generateOutput(compiler, text); |
| 2797 compareWarningKinds(text, warnings, collector.warnings); | 2797 compareWarningKinds(text, warnings, collector.warnings); |
| 2798 compareWarningKinds(text, hints, collector.hints); | 2798 compareWarningKinds(text, hints, collector.hints); |
| 2799 } | 2799 } |
| OLD | NEW |