| Index: sdk/lib/_internal/compiler/implementation/js_backend/type_variable_handler.dart
|
| diff --git a/sdk/lib/_internal/compiler/implementation/js_backend/type_variable_handler.dart b/sdk/lib/_internal/compiler/implementation/js_backend/type_variable_handler.dart
|
| index a336f32f8834e4aff0f880e9716c488243b1e7f8..76a8a8ceec8e78456b71af459fbdd50d6c8029d9 100644
|
| --- a/sdk/lib/_internal/compiler/implementation/js_backend/type_variable_handler.dart
|
| +++ b/sdk/lib/_internal/compiler/implementation/js_backend/type_variable_handler.dart
|
| @@ -65,27 +65,42 @@ class TypeVariableHandler {
|
| List<int> constants = <int>[];
|
|
|
| for (TypeVariableType currentTypeVariable in cls.typeVariables) {
|
| - List<Constant> createArguments(FunctionElement constructor) {
|
| - if (constructor != typeVariableConstructor) {
|
| - compiler.internalError(currentTypeVariable.element,
|
| - 'Unexpected constructor $constructor');
|
| - }
|
| - Constant name = backend.constantSystem.createString(
|
| - new DartString.literal(currentTypeVariable.name));
|
| - Constant bound = backend.constantSystem.createInt(
|
| - emitter.reifyType(currentTypeVariable.element.bound));
|
| - Constant type = backend.constants.createTypeConstant(cls);
|
| - return [type, name, bound];
|
| + TypeVariableElement typeVariableElement = currentTypeVariable.element;
|
| +
|
| + AstConstant wrapConstant(ConstExp constant) {
|
| + return new AstConstant(typeVariableElement,
|
| + typeVariableElement.node,
|
| + constant);
|
| }
|
|
|
| - Constant c = CompileTimeConstantEvaluator.makeConstructedConstant(
|
| - compiler, backend.constants,
|
| - currentTypeVariable.element, typeVariableType,
|
| - typeVariableConstructor, createArguments);
|
| - backend.registerCompileTimeConstant(c, compiler.globalDependencies);
|
| - backend.constants.addCompileTimeConstantForEmission(c);
|
| + ConstExp name = new PrimitiveConstExp(
|
| + backend.constantSystem.createString(
|
| + new DartString.literal(currentTypeVariable.name)));
|
| + ConstExp bound = new PrimitiveConstExp(
|
| + backend.constantSystem.createInt(
|
| + emitter.reifyType(typeVariableElement.bound)));
|
| + ConstExp type = backend.constants.createTypeConstant(cls);
|
| + List<AstConstant> arguments =
|
| + [wrapConstant(type), wrapConstant(name), wrapConstant(bound)];
|
| +
|
| + // TODO(johnniwinther): Support a less front-end specific creation of
|
| + // constructed constants.
|
| + AstConstant constant =
|
| + CompileTimeConstantEvaluator.makeConstructedConstant(
|
| + compiler,
|
| + backend.constants,
|
| + typeVariableElement,
|
| + typeVariableElement.node,
|
| + typeVariableType,
|
| + typeVariableConstructor,
|
| + new Selector.callConstructor('', null, 3),
|
| + arguments,
|
| + arguments);
|
| + Constant value = constant.value;
|
| + backend.registerCompileTimeConstant(value, compiler.globalDependencies);
|
| + backend.constants.addCompileTimeConstantForEmission(value);
|
| constants.add(
|
| - reifyTypeVariableConstant(c, currentTypeVariable.element));
|
| + reifyTypeVariableConstant(value, currentTypeVariable.element));
|
| }
|
| typeVariables[cls] = constants;
|
| }
|
|
|