OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 // Function signatures used in the generation of runtime type information. | 7 // Function signatures used in the generation of runtime type information. |
8 typedef void FunctionTypeSignatureEmitter( | 8 typedef void FunctionTypeSignatureEmitter( |
9 Element method, FunctionType methodType); | 9 Element method, FunctionType methodType); |
10 | 10 |
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
305 StubMethod _generateTypeVariableReader( | 305 StubMethod _generateTypeVariableReader( |
306 ClassElement cls, TypeVariableElement element) { | 306 ClassElement cls, TypeVariableElement element) { |
307 jsAst.Name name = namer.nameForReadTypeVariable(element); | 307 jsAst.Name name = namer.nameForReadTypeVariable(element); |
308 int index = element.index; | 308 int index = element.index; |
309 jsAst.Expression computeTypeVariable; | 309 jsAst.Expression computeTypeVariable; |
310 | 310 |
311 Substitution substitution = | 311 Substitution substitution = |
312 backend.rti.getSubstitution(cls, element.typeDeclaration); | 312 backend.rti.getSubstitution(cls, element.typeDeclaration); |
313 if (substitution != null) { | 313 if (substitution != null) { |
314 computeTypeVariable = js( | 314 computeTypeVariable = js( |
315 r'#.apply(null, this.$builtinTypeInfo)', | 315 r'#.apply(null, this.$ti)', |
316 backend.rtiEncoder | 316 backend.rtiEncoder |
317 .getSubstitutionCodeForVariable(substitution, index)); | 317 .getSubstitutionCodeForVariable(substitution, index)); |
318 } else { | 318 } else { |
319 // TODO(ahe): These can be generated dynamically. | 319 // TODO(ahe): These can be generated dynamically. |
320 computeTypeVariable = js( | 320 computeTypeVariable = js( |
321 r'this.$builtinTypeInfo && this.$builtinTypeInfo[#]', | 321 r'this.$ti && this.$ti[#]', |
322 js.number(index)); | 322 js.number(index)); |
323 } | 323 } |
324 jsAst.Expression convertRtiToRuntimeType = backend.emitter | 324 jsAst.Expression convertRtiToRuntimeType = backend.emitter |
325 .staticFunctionAccess(backend.helpers.convertRtiToRuntimeType); | 325 .staticFunctionAccess(backend.helpers.convertRtiToRuntimeType); |
326 | 326 |
327 return new StubMethod( | 327 return new StubMethod( |
328 name, | 328 name, |
329 js('function () { return #(#) }', | 329 js('function () { return #(#) }', |
330 [convertRtiToRuntimeType, computeTypeVariable])); | 330 [convertRtiToRuntimeType, computeTypeVariable])); |
331 } | 331 } |
332 } | 332 } |
OLD | NEW |