Chromium Code Reviews| 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 586 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 597 class B extends A {} | 597 class B extends A {} |
| 598 main() { return new A(); }"""); | 598 main() { return new A(); }"""); |
| 599 FunctionElement mainElement = compiler.mainApp.find(MAIN); | 599 FunctionElement mainElement = compiler.mainApp.find(MAIN); |
| 600 compiler.resolver.resolve(mainElement); | 600 compiler.resolver.resolve(mainElement); |
| 601 Expect.equals(0, compiler.warnings.length); | 601 Expect.equals(0, compiler.warnings.length); |
| 602 Expect.equals(1, compiler.errors.length); | 602 Expect.equals(1, compiler.errors.length); |
| 603 Expect.equals(MessageKind.CYCLIC_CLASS_HIERARCHY, | 603 Expect.equals(MessageKind.CYCLIC_CLASS_HIERARCHY, |
| 604 compiler.errors[0].message.kind); | 604 compiler.errors[0].message.kind); |
| 605 | 605 |
| 606 compiler = new MockCompiler(); | 606 compiler = new MockCompiler(); |
| 607 compiler.parseScript("""interface A extends B {} | |
|
ngeoffray
2012/11/16 11:31:18
As discussed, please remember to change it to abst
ahe
2012/11/16 11:35:20
Done.
| |
| 608 interface B extends A {} | |
| 609 class C implements A {} | |
| 610 main() { return new C(); }"""); | |
| 611 mainElement = compiler.mainApp.find(MAIN); | |
| 612 compiler.resolver.resolve(mainElement); | |
| 613 Expect.equals(0, compiler.warnings.length); | |
| 614 Expect.equals(1, compiler.errors.length); | |
| 615 Expect.equals(MessageKind.CYCLIC_CLASS_HIERARCHY, | |
| 616 compiler.errors[0].message.kind); | |
| 617 | |
| 618 compiler = new MockCompiler(); | |
| 619 compiler.parseScript("""class A extends B {} | 607 compiler.parseScript("""class A extends B {} |
| 620 class B extends C {} | 608 class B extends C {} |
| 621 class C {} | 609 class C {} |
| 622 main() { return new A(); }"""); | 610 main() { return new A(); }"""); |
| 623 mainElement = compiler.mainApp.find(MAIN); | 611 mainElement = compiler.mainApp.find(MAIN); |
| 624 compiler.resolver.resolve(mainElement); | 612 compiler.resolver.resolve(mainElement); |
| 625 Expect.equals(0, compiler.warnings.length); | 613 Expect.equals(0, compiler.warnings.length); |
| 626 Expect.equals(0, compiler.errors.length); | 614 Expect.equals(0, compiler.errors.length); |
| 627 ClassElement aElement = compiler.mainApp.find(buildSourceString("A")); | 615 ClassElement aElement = compiler.mainApp.find(buildSourceString("A")); |
| 628 Link<DartType> supertypes = aElement.allSupertypes; | 616 Link<DartType> supertypes = aElement.allSupertypes; |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 807 var d = new D(); | 795 var d = new D(); |
| 808 --d; | 796 --d; |
| 809 }"""; | 797 }"""; |
| 810 final compiler = compileScript(script); | 798 final compiler = compileScript(script); |
| 811 | 799 |
| 812 checkMemberResolved(compiler, 'A', operatorName('+', false)); | 800 checkMemberResolved(compiler, 'A', operatorName('+', false)); |
| 813 checkMemberResolved(compiler, 'B', operatorName('+', false)); | 801 checkMemberResolved(compiler, 'B', operatorName('+', false)); |
| 814 checkMemberResolved(compiler, 'C', operatorName('-', false)); | 802 checkMemberResolved(compiler, 'C', operatorName('-', false)); |
| 815 checkMemberResolved(compiler, 'D', operatorName('-', false)); | 803 checkMemberResolved(compiler, 'D', operatorName('-', false)); |
| 816 } | 804 } |
| OLD | NEW |