| 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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 testSuperCalls(); | 70 testSuperCalls(); |
| 71 testTypeVariables(); | 71 testTypeVariables(); |
| 72 } | 72 } |
| 73 | 73 |
| 74 testTypeVariables() { | 74 testTypeVariables() { |
| 75 matchResolvedTypes(visitor, text, name, expectedElements) { | 75 matchResolvedTypes(visitor, text, name, expectedElements) { |
| 76 VariableDefinitions definition = parseStatement(text); | 76 VariableDefinitions definition = parseStatement(text); |
| 77 visitor.visit(definition.type); | 77 visitor.visit(definition.type); |
| 78 InterfaceType type = visitor.mapping.getType(definition.type); | 78 InterfaceType type = visitor.mapping.getType(definition.type); |
| 79 Expect.equals(definition.type.typeArguments.length(), | 79 Expect.equals(definition.type.typeArguments.length(), |
| 80 length(type.arguments)); | 80 length(type.typeArguments)); |
| 81 int index = 0; | 81 int index = 0; |
| 82 Link<Type> arguments = type.arguments; | 82 Link<Type> arguments = type.typeArguments; |
| 83 while (!arguments.isEmpty()) { | 83 while (!arguments.isEmpty()) { |
| 84 Expect.equals(true, index < expectedElements.length); | 84 Expect.equals(true, index < expectedElements.length); |
| 85 Expect.equals(expectedElements[index], arguments.head.element); | 85 Expect.equals(expectedElements[index], arguments.head.element); |
| 86 index++; | 86 index++; |
| 87 arguments = arguments.tail; | 87 arguments = arguments.tail; |
| 88 } | 88 } |
| 89 Expect.equals(index, expectedElements.length); | 89 Expect.equals(index, expectedElements.length); |
| 90 } | 90 } |
| 91 | 91 |
| 92 MockCompiler compiler = new MockCompiler(); | 92 MockCompiler compiler = new MockCompiler(); |
| (...skipping 618 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 711 length(Link link) => link.isEmpty() ? 0 : length(link.tail) + 1; | 711 length(Link link) => link.isEmpty() ? 0 : length(link.tail) + 1; |
| 712 | 712 |
| 713 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); |
| 714 | 714 |
| 715 List<String> asSortedStrings(Link link) { | 715 List<String> asSortedStrings(Link link) { |
| 716 List<String> result = <String>[]; | 716 List<String> result = <String>[]; |
| 717 for (; !link.isEmpty(); link = link.tail) result.add(link.head.toString()); | 717 for (; !link.isEmpty(); link = link.tail) result.add(link.head.toString()); |
| 718 result.sort((s1, s2) => s1.compareTo(s2)); | 718 result.sort((s1, s2) => s1.compareTo(s2)); |
| 719 return result; | 719 return result; |
| 720 } | 720 } |
| OLD | NEW |