| 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 "package:expect/expect.dart"; | 5 import "package:expect/expect.dart"; |
| 6 import 'dart:async'; | 6 import 'dart:async'; |
| 7 import "package:async_helper/async_helper.dart"; | 7 import "package:async_helper/async_helper.dart"; |
| 8 import 'dart:collection'; | 8 import 'dart:collection'; |
| 9 | 9 |
| 10 import "../../../sdk/lib/_internal/compiler/implementation/resolution/resolution
.dart"; | 10 import "../../../sdk/lib/_internal/compiler/implementation/resolution/resolution
.dart"; |
| (...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 454 // Test that 'var' does not create a warning. | 454 // Test that 'var' does not create a warning. |
| 455 mapping = compiler.resolveStatement("var foo;").map; | 455 mapping = compiler.resolveStatement("var foo;").map; |
| 456 Expect.equals(1, mapping.length); | 456 Expect.equals(1, mapping.length); |
| 457 Expect.equals(0, compiler.warnings.length); | 457 Expect.equals(0, compiler.warnings.length); |
| 458 } | 458 } |
| 459 | 459 |
| 460 testSuperclass() { | 460 testSuperclass() { |
| 461 MockCompiler compiler = new MockCompiler(); | 461 MockCompiler compiler = new MockCompiler(); |
| 462 compiler.parseScript("class Foo extends Bar {}"); | 462 compiler.parseScript("class Foo extends Bar {}"); |
| 463 compiler.resolveStatement("Foo bar;"); | 463 compiler.resolveStatement("Foo bar;"); |
| 464 // TODO(ahe): We get the same error twice: once from | 464 Expect.equals(1, compiler.errors.length); |
| 465 // ClassResolverVisitor, and once from ClassSupertypeResolver. We | 465 var cannotResolveBar = new Message(MessageKind.CANNOT_EXTEND_MALFORMED, |
| 466 // should only the get the error once. | |
| 467 Expect.equals(2, compiler.errors.length); | |
| 468 var cannotResolveBar = new Message(MessageKind.CANNOT_RESOLVE_TYPE.error, | |
| 469 {'typeName': 'Bar'}, false); | 466 {'typeName': 'Bar'}, false); |
| 470 Expect.equals(cannotResolveBar, compiler.errors[0].message); | 467 Expect.equals(cannotResolveBar, compiler.errors[0].message); |
| 471 Expect.equals(cannotResolveBar, compiler.errors[1].message); | |
| 472 compiler.clearErrors(); | 468 compiler.clearErrors(); |
| 473 | 469 |
| 474 compiler = new MockCompiler(); | 470 compiler = new MockCompiler(); |
| 475 compiler.parseScript("class Foo extends Bar {}"); | 471 compiler.parseScript("class Foo extends Bar {}"); |
| 476 compiler.parseScript("class Bar {}"); | 472 compiler.parseScript("class Bar {}"); |
| 477 Map mapping = compiler.resolveStatement("Foo bar;").map; | 473 Map mapping = compiler.resolveStatement("Foo bar;").map; |
| 478 Expect.equals(2, mapping.length); | 474 Expect.equals(2, mapping.length); |
| 479 | 475 |
| 480 ClassElement fooElement = compiler.mainApp.find(buildSourceString('Foo')); | 476 ClassElement fooElement = compiler.mainApp.find(buildSourceString('Foo')); |
| 481 ClassElement barElement = compiler.mainApp.find(buildSourceString('Bar')); | 477 ClassElement barElement = compiler.mainApp.find(buildSourceString('Bar')); |
| (...skipping 485 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 967 }"""; | 963 }"""; |
| 968 asyncTest(() => compileScript(script2).then((compiler) { | 964 asyncTest(() => compileScript(script2).then((compiler) { |
| 969 expect(compiler, | 965 expect(compiler, |
| 970 [MessageKind.CONST_CONSTRUCTOR_WITH_NONFINAL_FIELDS], | 966 [MessageKind.CONST_CONSTRUCTOR_WITH_NONFINAL_FIELDS], |
| 971 [MessageKind.CONST_CONSTRUCTOR_WITH_NONFINAL_FIELDS_CONSTRUCTOR, | 967 [MessageKind.CONST_CONSTRUCTOR_WITH_NONFINAL_FIELDS_CONSTRUCTOR, |
| 972 MessageKind.CONST_CONSTRUCTOR_WITH_NONFINAL_FIELDS_CONSTRUCTOR, | 968 MessageKind.CONST_CONSTRUCTOR_WITH_NONFINAL_FIELDS_CONSTRUCTOR, |
| 973 MessageKind.CONST_CONSTRUCTOR_WITH_NONFINAL_FIELDS_FIELD, | 969 MessageKind.CONST_CONSTRUCTOR_WITH_NONFINAL_FIELDS_FIELD, |
| 974 MessageKind.CONST_CONSTRUCTOR_WITH_NONFINAL_FIELDS_FIELD]); | 970 MessageKind.CONST_CONSTRUCTOR_WITH_NONFINAL_FIELDS_FIELD]); |
| 975 })); | 971 })); |
| 976 } | 972 } |
| OLD | NEW |