| 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:uri'; | 5 import 'dart:uri'; |
| 6 | 6 |
| 7 import "../../../sdk/lib/_internal/compiler/implementation/dart2jslib.dart" | 7 import "../../../sdk/lib/_internal/compiler/implementation/dart2jslib.dart" |
| 8 hide TreeElementMapping, TreeElements, SourceString; | 8 hide TreeElementMapping, TreeElements, SourceString; |
| 9 import "../../../sdk/lib/_internal/compiler/implementation/resolution/resolution
.dart"; | 9 import "../../../sdk/lib/_internal/compiler/implementation/resolution/resolution
.dart"; |
| 10 import "../../../sdk/lib/_internal/compiler/implementation/elements/elements.dar
t"; | 10 import "../../../sdk/lib/_internal/compiler/implementation/elements/elements.dar
t"; |
| (...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 386 Expect.equals(expected, actual); | 386 Expect.equals(expected, actual); |
| 387 } | 387 } |
| 388 | 388 |
| 389 testTypeAnnotation() { | 389 testTypeAnnotation() { |
| 390 MockCompiler compiler = new MockCompiler(); | 390 MockCompiler compiler = new MockCompiler(); |
| 391 String statement = "Foo bar;"; | 391 String statement = "Foo bar;"; |
| 392 | 392 |
| 393 // Test that we get a warning when Foo is not defined. | 393 // Test that we get a warning when Foo is not defined. |
| 394 Map mapping = compiler.resolveStatement(statement).map; | 394 Map mapping = compiler.resolveStatement(statement).map; |
| 395 | 395 |
| 396 Expect.equals(1, mapping.length); // bar has an element. | 396 Expect.equals(2, mapping.length); // Both Foo and bar have an element. |
| 397 Expect.equals(1, compiler.warnings.length); | 397 Expect.equals(1, compiler.warnings.length); |
| 398 | 398 |
| 399 Node warningNode = compiler.warnings[0].node; | 399 Node warningNode = compiler.warnings[0].node; |
| 400 | 400 |
| 401 Expect.equals( | 401 Expect.equals( |
| 402 new Message(MessageKind.CANNOT_RESOLVE_TYPE, ['Foo']), | 402 new Message(MessageKind.CANNOT_RESOLVE_TYPE, ['Foo']), |
| 403 compiler.warnings[0].message); | 403 compiler.warnings[0].message); |
| 404 VariableDefinitions definition = compiler.parsedTree; | 404 VariableDefinitions definition = compiler.parsedTree; |
| 405 Expect.equals(warningNode, definition.type); | 405 Expect.equals(warningNode, definition.type); |
| 406 compiler.clearWarnings(); | 406 compiler.clearWarnings(); |
| (...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 807 var d = new D(); | 807 var d = new D(); |
| 808 --d; | 808 --d; |
| 809 }"""; | 809 }"""; |
| 810 final compiler = compileScript(script); | 810 final compiler = compileScript(script); |
| 811 | 811 |
| 812 checkMemberResolved(compiler, 'A', operatorName('+', false)); | 812 checkMemberResolved(compiler, 'A', operatorName('+', false)); |
| 813 checkMemberResolved(compiler, 'B', operatorName('+', false)); | 813 checkMemberResolved(compiler, 'B', operatorName('+', false)); |
| 814 checkMemberResolved(compiler, 'C', operatorName('-', false)); | 814 checkMemberResolved(compiler, 'C', operatorName('-', false)); |
| 815 checkMemberResolved(compiler, 'D', operatorName('-', false)); | 815 checkMemberResolved(compiler, 'D', operatorName('-', false)); |
| 816 } | 816 } |
| OLD | NEW |