| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 part of js_backend; | 5 part of js_backend; |
| 6 | 6 |
| 7 /** | 7 /** |
| 8 * Handles construction of TypeVariable constants needed at runtime. | 8 * Handles construction of TypeVariable constants needed at runtime. |
| 9 */ | 9 */ |
| 10 class TypeVariableHandler { | 10 class TypeVariableHandler { |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 InterfaceType typeVariableType = typeVariableClass.computeType(compiler); | 80 InterfaceType typeVariableType = typeVariableClass.computeType(compiler); |
| 81 List<int> constants = <int>[]; | 81 List<int> constants = <int>[]; |
| 82 for (TypeVariableType currentTypeVariable in cls.typeVariables) { | 82 for (TypeVariableType currentTypeVariable in cls.typeVariables) { |
| 83 List<Constant> createArguments(FunctionElement constructor) { | 83 List<Constant> createArguments(FunctionElement constructor) { |
| 84 if (constructor != typeVariableConstructor) { | 84 if (constructor != typeVariableConstructor) { |
| 85 compiler.internalErrorOnElement( | 85 compiler.internalErrorOnElement( |
| 86 currentTypeVariable.element, | 86 currentTypeVariable.element, |
| 87 'Unexpected constructor $constructor'); | 87 'Unexpected constructor $constructor'); |
| 88 } | 88 } |
| 89 Constant name = backend.constantSystem.createString( | 89 Constant name = backend.constantSystem.createString( |
| 90 new DartString.literal(currentTypeVariable.name.slowToString()), | 90 new DartString.literal(currentTypeVariable.name), |
| 91 null); | 91 null); |
| 92 Constant bound = backend.constantSystem.createInt( | 92 Constant bound = backend.constantSystem.createInt( |
| 93 emitter.reifyType(currentTypeVariable.element.bound)); | 93 emitter.reifyType(currentTypeVariable.element.bound)); |
| 94 Constant type = evaluator.makeTypeConstant(cls); | 94 Constant type = evaluator.makeTypeConstant(cls); |
| 95 return [type, name, bound]; | 95 return [type, name, bound]; |
| 96 } | 96 } |
| 97 | 97 |
| 98 Constant c = evaluator.makeConstructedConstant( | 98 Constant c = evaluator.makeConstructedConstant( |
| 99 currentTypeVariable.element, typeVariableType, | 99 currentTypeVariable.element, typeVariableType, |
| 100 typeVariableConstructor, createArguments); | 100 typeVariableConstructor, createArguments); |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 } | 147 } |
| 148 | 148 |
| 149 emitter.globalMetadata.add('Placeholder for ${variable}'); | 149 emitter.globalMetadata.add('Placeholder for ${variable}'); |
| 150 return typeVariableConstants[variable] = emitter.globalMetadata.length - 1; | 150 return typeVariableConstants[variable] = emitter.globalMetadata.length - 1; |
| 151 } | 151 } |
| 152 | 152 |
| 153 List<int> typeVariablesOf(ClassElement classElement) { | 153 List<int> typeVariablesOf(ClassElement classElement) { |
| 154 return typeVariables[classElement]; | 154 return typeVariables[classElement]; |
| 155 } | 155 } |
| 156 } | 156 } |
| OLD | NEW |