| 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 dart2js.js_emitter; | 5 part of dart2js.js_emitter; |
| 6 | 6 |
| 7 class ClassEmitter extends CodeEmitterHelper { | 7 class ClassEmitter extends CodeEmitterHelper { |
| 8 | 8 |
| 9 ClassStubGenerator get _stubGenerator => | 9 ClassStubGenerator get _stubGenerator => |
| 10 new ClassStubGenerator(compiler, namer, backend); | 10 new ClassStubGenerator(compiler, namer, backend); |
| (...skipping 591 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 602 TypeVariableElement element) { | 602 TypeVariableElement element) { |
| 603 String name = namer.readTypeVariableName(element); | 603 String name = namer.readTypeVariableName(element); |
| 604 int index = RuntimeTypes.getTypeVariableIndex(element); | 604 int index = RuntimeTypes.getTypeVariableIndex(element); |
| 605 jsAst.Expression computeTypeVariable; | 605 jsAst.Expression computeTypeVariable; |
| 606 | 606 |
| 607 Substitution substitution = | 607 Substitution substitution = |
| 608 backend.rti.computeSubstitution( | 608 backend.rti.computeSubstitution( |
| 609 cls, element.typeDeclaration, alwaysGenerateFunction: true); | 609 cls, element.typeDeclaration, alwaysGenerateFunction: true); |
| 610 if (substitution != null) { | 610 if (substitution != null) { |
| 611 computeTypeVariable = | 611 computeTypeVariable = |
| 612 js(r'#(this.$builtinTypeInfo)', | 612 js(r'#.apply(null, this.$builtinTypeInfo)', |
| 613 substitution.getCodeForVariable(index, backend.rti)); | 613 substitution.getCodeForVariable(index, backend.rti)); |
| 614 } else { | 614 } else { |
| 615 // TODO(ahe): These can be generated dynamically. | 615 // TODO(ahe): These can be generated dynamically. |
| 616 computeTypeVariable = | 616 computeTypeVariable = |
| 617 js(r'this.$builtinTypeInfo && this.$builtinTypeInfo[#]', | 617 js(r'this.$builtinTypeInfo && this.$builtinTypeInfo[#]', |
| 618 js.number(index)); | 618 js.number(index)); |
| 619 } | 619 } |
| 620 jsAst.Expression convertRtiToRuntimeType = emitter | 620 jsAst.Expression convertRtiToRuntimeType = emitter |
| 621 .staticFunctionAccess(backend.findHelper('convertRtiToRuntimeType')); | 621 .staticFunctionAccess(backend.findHelper('convertRtiToRuntimeType')); |
| 622 compiler.dumpInfoTask.registerElementAst(element, | 622 compiler.dumpInfoTask.registerElementAst(element, |
| 623 builder.addProperty(name, | 623 builder.addProperty(name, |
| 624 js('function () { return #(#) }', | 624 js('function () { return #(#) }', |
| 625 [convertRtiToRuntimeType, computeTypeVariable]))); | 625 [convertRtiToRuntimeType, computeTypeVariable]))); |
| 626 } | 626 } |
| 627 } | 627 } |
| OLD | NEW |