| 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("../../../lib/compiler/implementation/leg.dart"); | 5 #import("../../../lib/compiler/implementation/leg.dart"); |
| 6 #import("../../../lib/compiler/implementation/elements/elements.dart"); | 6 #import("../../../lib/compiler/implementation/elements/elements.dart"); |
| 7 #import("../../../lib/compiler/implementation/tree/tree.dart"); | 7 #import("../../../lib/compiler/implementation/tree/tree.dart"); |
| 8 #import("../../../lib/compiler/implementation/util/util.dart"); | 8 #import("../../../lib/compiler/implementation/util/util.dart"); |
| 9 #import("mock_compiler.dart"); | 9 #import("mock_compiler.dart"); |
| 10 #import("parser_helper.dart"); | 10 #import("parser_helper.dart"); |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 compiler.warnings[0].message.kind); | 106 compiler.warnings[0].message.kind); |
| 107 Expect.equals(0, compiler.errors.length); | 107 Expect.equals(0, compiler.errors.length); |
| 108 | 108 |
| 109 compiler = new MockCompiler(); | 109 compiler = new MockCompiler(); |
| 110 compiler.parseScript('class Foo<T, U> {}'); | 110 compiler.parseScript('class Foo<T, U> {}'); |
| 111 compiler.resolveStatement('var x = new Foo<notype, int>();'); | 111 compiler.resolveStatement('var x = new Foo<notype, int>();'); |
| 112 Expect.equals(0, compiler.warnings.length); | 112 Expect.equals(0, compiler.warnings.length); |
| 113 Expect.equals(1, compiler.errors.length); | 113 Expect.equals(1, compiler.errors.length); |
| 114 Expect.equals(MessageKind.CANNOT_RESOLVE_TYPE, | 114 Expect.equals(MessageKind.CANNOT_RESOLVE_TYPE, |
| 115 compiler.errors[0].message.kind); | 115 compiler.errors[0].message.kind); |
| 116 |
| 117 compiler = new MockCompiler(); |
| 118 compiler.parseScript('class Foo<T> {' |
| 119 ' Foo<T> t;' |
| 120 ' foo(Foo<T> f) {}' |
| 121 ' bar() { g(Foo<T> f) {}; g(); }' |
| 122 '}'); |
| 123 foo = compiler.mainApp.find(buildSourceString('Foo')); |
| 124 compiler.resolveClass(foo); |
| 125 foo.lookupLocalMember(buildSourceString('t')).computeType(compiler);; |
| 126 foo.lookupLocalMember(buildSourceString('foo')).computeType(compiler);; |
| 127 compiler.resolver.resolve(foo.lookupLocalMember(buildSourceString('bar'))); |
| 128 Expect.equals(0, compiler.warnings.length); |
| 129 Expect.equals(0, compiler.errors.length); |
| 116 } | 130 } |
| 117 | 131 |
| 118 testSuperCalls() { | 132 testSuperCalls() { |
| 119 MockCompiler compiler = new MockCompiler(); | 133 MockCompiler compiler = new MockCompiler(); |
| 120 String script = """class A { foo() {} } | 134 String script = """class A { foo() {} } |
| 121 class B extends A { foo() => super.foo(); }"""; | 135 class B extends A { foo() => super.foo(); }"""; |
| 122 compiler.parseScript(script); | 136 compiler.parseScript(script); |
| 123 compiler.resolveStatement("B b;"); | 137 compiler.resolveStatement("B b;"); |
| 124 | 138 |
| 125 ClassElement classB = compiler.mainApp.find(buildSourceString("B")); | 139 ClassElement classB = compiler.mainApp.find(buildSourceString("B")); |
| (...skipping 571 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 697 length(Link link) => link.isEmpty() ? 0 : length(link.tail) + 1; | 711 length(Link link) => link.isEmpty() ? 0 : length(link.tail) + 1; |
| 698 | 712 |
| 699 at(Link link, int index) => (index == 0) ? link.head : at(link.tail, index - 1); | 713 at(Link link, int index) => (index == 0) ? link.head : at(link.tail, index - 1); |
| 700 | 714 |
| 701 List<String> asSortedStrings(Link link) { | 715 List<String> asSortedStrings(Link link) { |
| 702 List<String> result = <String>[]; | 716 List<String> result = <String>[]; |
| 703 for (; !link.isEmpty(); link = link.tail) result.add(link.head.toString()); | 717 for (; !link.isEmpty(); link = link.tail) result.add(link.head.toString()); |
| 704 result.sort((s1, s2) => s1.compareTo(s2)); | 718 result.sort((s1, s2) => s1.compareTo(s2)); |
| 705 return result; | 719 return result; |
| 706 } | 720 } |
| OLD | NEW |