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("../../../../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 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 89 | 89 |
| 90 MockCompiler compiler = new MockCompiler(); | 90 MockCompiler compiler = new MockCompiler(); |
| 91 ResolverVisitor visitor = compiler.resolverVisitor(); | 91 ResolverVisitor visitor = compiler.resolverVisitor(); |
| 92 compiler.parseScript('class Foo<T, U> {}'); | 92 compiler.parseScript('class Foo<T, U> {}'); |
| 93 visitor.visit(parseStatement('Foo foo;')); | 93 visitor.visit(parseStatement('Foo foo;')); |
| 94 ClassElement foo = compiler.mainApp.find(buildSourceString('Foo')); | 94 ClassElement foo = compiler.mainApp.find(buildSourceString('Foo')); |
| 95 testTypeResolving(visitor, 'Foo<int, String> x;', 'Foo', | 95 testTypeResolving(visitor, 'Foo<int, String> x;', 'Foo', |
| 96 [compiler.intClass, compiler.stringClass]); | 96 [compiler.intClass, compiler.stringClass]); |
| 97 testTypeResolving(visitor, 'Foo<Foo, Foo> x;', 'Foo', | 97 testTypeResolving(visitor, 'Foo<Foo, Foo> x;', 'Foo', |
| 98 [foo, foo]); | 98 [foo, foo]); |
| 99 | |
|
ahe
2012/04/18 09:09:54
Removing these lines does not help me :-)
| |
| 100 compiler = new MockCompiler(); | 99 compiler = new MockCompiler(); |
| 101 compiler.parseScript('class Foo<T, U> {}'); | 100 compiler.parseScript('class Foo<T, U> {}'); |
| 102 compiler.resolveStatement('Foo<notype, int> x;'); | 101 compiler.resolveStatement('Foo<notype, int> x;'); |
| 103 Expect.equals(1, compiler.warnings.length); | 102 Expect.equals(1, compiler.warnings.length); |
| 104 Expect.equals(MessageKind.CANNOT_RESOLVE_TYPE, | 103 Expect.equals(MessageKind.CANNOT_RESOLVE_TYPE, |
| 105 compiler.warnings[0].message.kind); | 104 compiler.warnings[0].message.kind); |
| 106 Expect.equals(0, compiler.errors.length); | 105 Expect.equals(0, compiler.errors.length); |
| 107 | |
| 108 compiler = new MockCompiler(); | 106 compiler = new MockCompiler(); |
| 109 compiler.parseScript('class Foo<T, U> {}'); | 107 compiler.parseScript('class Foo<T, U> {}'); |
| 110 compiler.resolveStatement('var x = new Foo<notype, int>();'); | 108 compiler.resolveStatement('var x = new Foo<notype, int>();'); |
| 111 Expect.equals(0, compiler.warnings.length); | 109 Expect.equals(0, compiler.warnings.length); |
| 112 Expect.equals(1, compiler.errors.length); | 110 Expect.equals(1, compiler.errors.length); |
| 113 Expect.equals(MessageKind.CANNOT_RESOLVE_TYPE, | 111 Expect.equals(MessageKind.CANNOT_RESOLVE_TYPE, |
| 114 compiler.errors[0].message.kind); | 112 compiler.errors[0].message.kind); |
| 115 } | 113 } |
| 116 | 114 |
| 117 testSuperCalls() { | 115 testSuperCalls() { |
| (...skipping 565 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 683 length(Link link) => link.isEmpty() ? 0 : length(link.tail) + 1; | 681 length(Link link) => link.isEmpty() ? 0 : length(link.tail) + 1; |
| 684 | 682 |
| 685 at(Link link, int index) => (index == 0) ? link.head : at(link.tail, index - 1); | 683 at(Link link, int index) => (index == 0) ? link.head : at(link.tail, index - 1); |
| 686 | 684 |
| 687 List<String> asSortedStrings(Link link) { | 685 List<String> asSortedStrings(Link link) { |
| 688 List<String> result = <String>[]; | 686 List<String> result = <String>[]; |
| 689 for (; !link.isEmpty(); link = link.tail) result.add(link.head.toString()); | 687 for (; !link.isEmpty(); link = link.tail) result.add(link.head.toString()); |
| 690 result.sort((s1, s2) => s1.compareTo(s2)); | 688 result.sort((s1, s2) => s1.compareTo(s2)); |
| 691 return result; | 689 return result; |
| 692 } | 690 } |
| OLD | NEW |