| 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 InvocationInfo { | 5 class InvocationInfo { |
| 6 int parameterCount; | 6 int parameterCount; |
| 7 List<HType> providedTypes; | 7 List<HType> providedTypes; |
| 8 List<Element> compiledFunctions; | 8 List<Element> compiledFunctions; |
| 9 | 9 |
| 10 InvocationInfo(List<HType> types) | 10 InvocationInfo(List<HType> types) |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 139 // that could alter the field. | 139 // that could alter the field. |
| 140 HType optimisticFieldTypeAfterConstruction(Element field) { | 140 HType optimisticFieldTypeAfterConstruction(Element field) { |
| 141 assert(field.isField()); | 141 assert(field.isField()); |
| 142 assert(field.isMember()); | 142 assert(field.isMember()); |
| 143 | 143 |
| 144 ClassElement classElement = field.getEnclosingClass(); | 144 ClassElement classElement = field.getEnclosingClass(); |
| 145 if (hasConstructorBodyFieldSetter(field)) { | 145 if (hasConstructorBodyFieldSetter(field)) { |
| 146 // If there are field setters but there is only constructor then the type | 146 // If there are field setters but there is only constructor then the type |
| 147 // of the field is determined by the assignments in the constructor | 147 // of the field is determined by the assignments in the constructor |
| 148 // body. | 148 // body. |
| 149 if (classElement.constructors.length == 1) { | 149 var constructors = classElement.constructors; |
| 150 if (constructors.head !== null && constructors.tail === null) { |
| 150 return fieldConstructorSetters[classElement][field]; | 151 return fieldConstructorSetters[classElement][field]; |
| 151 } else { | 152 } else { |
| 152 return HType.UNKNOWN; | 153 return HType.UNKNOWN; |
| 153 } | 154 } |
| 154 } else if (fieldInitializers.containsKey(classElement)) { | 155 } else if (fieldInitializers.containsKey(classElement)) { |
| 155 HType type = fieldInitializers[classElement][field]; | 156 HType type = fieldInitializers[classElement][field]; |
| 156 return type == null ? HType.CONFLICTING : type; | 157 return type == null ? HType.CONFLICTING : type; |
| 157 } else { | 158 } else { |
| 158 return HType.CONFLICTING; | 159 return HType.CONFLICTING; |
| 159 } | 160 } |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 270 if (foundCount == 1 && found.hasTypeInformation) { | 271 if (foundCount == 1 && found.hasTypeInformation) { |
| 271 FunctionSignature signature = element.computeSignature(compiler); | 272 FunctionSignature signature = element.computeSignature(compiler); |
| 272 if (signature.parameterCount == found.parameterCount) { | 273 if (signature.parameterCount == found.parameterCount) { |
| 273 found.addCompiledFunction(element); | 274 found.addCompiledFunction(element); |
| 274 return found.providedTypes; | 275 return found.providedTypes; |
| 275 } | 276 } |
| 276 } | 277 } |
| 277 return null; | 278 return null; |
| 278 } | 279 } |
| 279 } | 280 } |
| OLD | NEW |