| 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 '../../../sdk/lib/_internal/compiler/implementation/dart2jslib.dart' | 5 import '../../../sdk/lib/_internal/compiler/implementation/dart2jslib.dart' |
| 6 hide SourceString; | 6 hide SourceString; |
| 7 import '../../../sdk/lib/_internal/compiler/implementation/elements/elements.dar
t'; | 7 import '../../../sdk/lib/_internal/compiler/implementation/elements/elements.dar
t'; |
| 8 import '../../../sdk/lib/_internal/compiler/implementation/tree/tree.dart'; | 8 import '../../../sdk/lib/_internal/compiler/implementation/tree/tree.dart'; |
| 9 import '../../../sdk/lib/_internal/compiler/implementation/util/util.dart'; | 9 import '../../../sdk/lib/_internal/compiler/implementation/util/util.dart'; |
| 10 import 'mock_compiler.dart'; | 10 import 'mock_compiler.dart'; |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 analyze("{ int i = 1; bool j = i${op}; }", MessageKind.NOT_ASSIGNABLE); | 117 analyze("{ int i = 1; bool j = i${op}; }", MessageKind.NOT_ASSIGNABLE); |
| 118 analyze("{ bool b = true; bool j = b${op}; }"); | 118 analyze("{ bool b = true; bool j = b${op}; }"); |
| 119 analyze("{ bool b = true; int j = ${op}b; }"); | 119 analyze("{ bool b = true; int j = ${op}b; }"); |
| 120 } | 120 } |
| 121 for (final op in ['||', '&&']) { | 121 for (final op in ['||', '&&']) { |
| 122 analyze("{ bool b = (true ${op} false); }"); | 122 analyze("{ bool b = (true ${op} false); }"); |
| 123 analyze("{ int b = true ${op} false; }", MessageKind.NOT_ASSIGNABLE); | 123 analyze("{ int b = true ${op} false; }", MessageKind.NOT_ASSIGNABLE); |
| 124 analyze("{ bool b = (1 ${op} false); }", MessageKind.NOT_ASSIGNABLE); | 124 analyze("{ bool b = (1 ${op} false); }", MessageKind.NOT_ASSIGNABLE); |
| 125 analyze("{ bool b = (true ${op} 2); }", MessageKind.NOT_ASSIGNABLE); | 125 analyze("{ bool b = (true ${op} 2); }", MessageKind.NOT_ASSIGNABLE); |
| 126 } | 126 } |
| 127 for (final op in ['>', '<', '<=', '>=', '==', '!=', '===', '!==']) { | 127 for (final op in ['>', '<', '<=', '>=', '==', '!=']) { |
| 128 analyze("{ bool b = 1 ${op} 2; }"); | 128 analyze("{ bool b = 1 ${op} 2; }"); |
| 129 analyze("{ int i = 1 ${op} 2; }", MessageKind.NOT_ASSIGNABLE); | 129 analyze("{ int i = 1 ${op} 2; }", MessageKind.NOT_ASSIGNABLE); |
| 130 analyze("{ int i; bool b = (i = true) ${op} 2; }", | 130 analyze("{ int i; bool b = (i = true) ${op} 2; }", |
| 131 MessageKind.NOT_ASSIGNABLE); | 131 MessageKind.NOT_ASSIGNABLE); |
| 132 analyze("{ int i; bool b = 1 ${op} (i = true); }", | 132 analyze("{ int i; bool b = 1 ${op} (i = true); }", |
| 133 MessageKind.NOT_ASSIGNABLE); | 133 MessageKind.NOT_ASSIGNABLE); |
| 134 } | 134 } |
| 135 } | 135 } |
| 136 | 136 |
| 137 void testConstructorInvocationArgumentCount() { | 137 void testConstructorInvocationArgumentCount() { |
| (...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 466 Node node = listener.popNode(); | 466 Node node = listener.popNode(); |
| 467 classElement.ensureResolved(compiler); | 467 classElement.ensureResolved(compiler); |
| 468 TreeElements elements = compiler.resolveNodeStatement(node, classElement); | 468 TreeElements elements = compiler.resolveNodeStatement(node, classElement); |
| 469 TypeCheckerVisitor checker = new TypeCheckerVisitor(compiler, elements, | 469 TypeCheckerVisitor checker = new TypeCheckerVisitor(compiler, elements, |
| 470 types); | 470 types); |
| 471 compiler.clearWarnings(); | 471 compiler.clearWarnings(); |
| 472 checker.currentClass = classElement; | 472 checker.currentClass = classElement; |
| 473 checker.analyze(node); | 473 checker.analyze(node); |
| 474 compareWarningKinds(text, expectedWarnings, compiler.warnings); | 474 compareWarningKinds(text, expectedWarnings, compiler.warnings); |
| 475 } | 475 } |
| OLD | NEW |