| 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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 } | 74 } |
| 75 } | 75 } |
| 76 | 76 |
| 77 void generateFunctionTypeSignature( | 77 void generateFunctionTypeSignature( |
| 78 FunctionElement method, FunctionType type) { | 78 FunctionElement method, FunctionType type) { |
| 79 assert(method.isImplementation); | 79 assert(method.isImplementation); |
| 80 jsAst.Expression thisAccess = new jsAst.This(); | 80 jsAst.Expression thisAccess = new jsAst.This(); |
| 81 if (!method.isAbstract) { | 81 if (!method.isAbstract) { |
| 82 ClosureClassMap closureData = compiler.closureToClassMapper | 82 ClosureClassMap closureData = compiler.closureToClassMapper |
| 83 .getClosureToClassMapping(method.resolvedAst); | 83 .getClosureToClassMapping(method.resolvedAst); |
| 84 ClosureFieldElement thisLocal = | 84 if (closureData != null) { |
| 85 closureData.freeVariableMap[closureData.thisLocal]; | 85 ClosureFieldElement thisLocal = |
| 86 if (thisLocal != null) { | 86 closureData.freeVariableMap[closureData.thisLocal]; |
| 87 jsAst.Name thisName = namer.instanceFieldPropertyName(thisLocal); | 87 if (thisLocal != null) { |
| 88 thisAccess = js('this.#', thisName); | 88 jsAst.Name thisName = namer.instanceFieldPropertyName(thisLocal); |
| 89 thisAccess = js('this.#', thisName); |
| 90 } |
| 89 } | 91 } |
| 90 } | 92 } |
| 91 | 93 |
| 92 if (storeFunctionTypeInMetadata && !type.containsTypeVariables) { | 94 if (storeFunctionTypeInMetadata && !type.containsTypeVariables) { |
| 93 result.functionTypeIndex = | 95 result.functionTypeIndex = |
| 94 emitterTask.metadataCollector.reifyType(type); | 96 emitterTask.metadataCollector.reifyType(type); |
| 95 } else { | 97 } else { |
| 96 RuntimeTypesEncoder rtiEncoder = backend.rtiEncoder; | 98 RuntimeTypesEncoder rtiEncoder = backend.rtiEncoder; |
| 97 jsAst.Expression encoding = | 99 jsAst.Expression encoding = |
| 98 rtiEncoder.getSignatureEncoding(type, thisAccess); | 100 rtiEncoder.getSignatureEncoding(type, thisAccess); |
| (...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 333 } | 335 } |
| 334 jsAst.Expression convertRtiToRuntimeType = backend.emitter | 336 jsAst.Expression convertRtiToRuntimeType = backend.emitter |
| 335 .staticFunctionAccess(backend.helpers.convertRtiToRuntimeType); | 337 .staticFunctionAccess(backend.helpers.convertRtiToRuntimeType); |
| 336 | 338 |
| 337 return new StubMethod( | 339 return new StubMethod( |
| 338 name, | 340 name, |
| 339 js('function () { return #(#) }', | 341 js('function () { return #(#) }', |
| 340 [convertRtiToRuntimeType, computeTypeVariable])); | 342 [convertRtiToRuntimeType, computeTypeVariable])); |
| 341 } | 343 } |
| 342 } | 344 } |
| OLD | NEW |