| 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 class ElementAst { | 5 class ElementAst { |
| 6 final Node ast; | 6 final Node ast; |
| 7 final TreeElements treeElements; | 7 final TreeElements treeElements; |
| 8 | 8 |
| 9 ElementAst(this.ast, this.treeElements); | 9 ElementAst(this.ast, this.treeElements); |
| 10 | 10 |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 * or type variable bounds typedefs. | 125 * or type variable bounds typedefs. |
| 126 * These restrictions can be less strict. | 126 * These restrictions can be less strict. |
| 127 */ | 127 */ |
| 128 bool isSafeToRemoveTypeDeclarations( | 128 bool isSafeToRemoveTypeDeclarations( |
| 129 Map<ClassElement, Set<Element>> classMembers) { | 129 Map<ClassElement, Set<Element>> classMembers) { |
| 130 Set<DartType> processedTypes = new Set<DartType>(); | 130 Set<DartType> processedTypes = new Set<DartType>(); |
| 131 List<DartType> workQueue = new List<DartType>(); | 131 List<DartType> workQueue = new List<DartType>(); |
| 132 workQueue.addAll( | 132 workQueue.addAll( |
| 133 classMembers.getKeys().map((classElement) => classElement.type)); | 133 classMembers.getKeys().map((classElement) => classElement.type)); |
| 134 workQueue.addAll(compiler.resolverWorld.isChecks); | 134 workQueue.addAll(compiler.resolverWorld.isChecks); |
| 135 DartType typeErrorType = | 135 Element typeErrorElement = |
| 136 compiler.coreLibrary.find(new SourceString('TypeError')).type; | 136 compiler.coreLibrary.find(new SourceString('TypeError')); |
| 137 DartType typeErrorType = typeErrorElement.computeType(compiler); |
| 137 if (workQueue.indexOf(typeErrorType) != -1) { | 138 if (workQueue.indexOf(typeErrorType) != -1) { |
| 138 return false; | 139 return false; |
| 139 } | 140 } |
| 140 | 141 |
| 141 void processTypeArguments(Element classElement, NodeList typeArguments) { | 142 void processTypeArguments(Element classElement, NodeList typeArguments) { |
| 142 if (typeArguments == null) return; | 143 if (typeArguments == null) return; |
| 143 for (Node typeArgument in typeArguments.nodes) { | 144 for (Node typeArgument in typeArguments.nodes) { |
| 144 if (typeArgument is TypeVariable) { | 145 if (typeArgument is TypeVariable) { |
| 145 typeArgument = typeArgument.bound; | 146 typeArgument = typeArgument.bound; |
| 146 } | 147 } |
| (...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 533 } | 534 } |
| 534 | 535 |
| 535 compareElements(e0, e1) { | 536 compareElements(e0, e1) { |
| 536 int result = compareBy((e) => e.getLibrary().uri.toString())(e0, e1); | 537 int result = compareBy((e) => e.getLibrary().uri.toString())(e0, e1); |
| 537 if (result != 0) return result; | 538 if (result != 0) return result; |
| 538 return compareBy((e) => e.position().charOffset)(e0, e1); | 539 return compareBy((e) => e.position().charOffset)(e0, e1); |
| 539 } | 540 } |
| 540 | 541 |
| 541 List<Element> sortElements(Collection<Element> elements) => | 542 List<Element> sortElements(Collection<Element> elements) => |
| 542 sorted(elements, compareElements); | 543 sorted(elements, compareElements); |
| OLD | NEW |