| 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 library dart2js.js_emitter.runtime_type_generator; | 5 library dart2js.js_emitter.runtime_type_generator; |
| 6 | 6 |
| 7 import '../closure.dart' | 7 import '../closure.dart' |
| 8 show ClosureRepresentationInfo, ClosureFieldElement, ClosureConversionTask; | 8 show ClosureRepresentationInfo, ClosureFieldElement, ClosureConversionTask; |
| 9 import '../common.dart'; | 9 import '../common.dart'; |
| 10 import '../common/names.dart' show Identifiers; | 10 import '../common/names.dart' show Identifiers; |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 } | 121 } |
| 122 } | 122 } |
| 123 | 123 |
| 124 void generateFunctionTypeSignature( | 124 void generateFunctionTypeSignature( |
| 125 FunctionElement method, ResolutionFunctionType type) { | 125 FunctionElement method, ResolutionFunctionType type) { |
| 126 assert(method.isImplementation); | 126 assert(method.isImplementation); |
| 127 jsAst.Expression thisAccess = new jsAst.This(); | 127 jsAst.Expression thisAccess = new jsAst.This(); |
| 128 if (!method.isAbstract) { | 128 if (!method.isAbstract) { |
| 129 ClosureRepresentationInfo closureData = | 129 ClosureRepresentationInfo closureData = |
| 130 _closureDataLookup.getClosureRepresentationInfo(method); | 130 _closureDataLookup.getClosureRepresentationInfo(method); |
| 131 if (closureData.isClosure && closureData.thisLocal != null) { | 131 if (closureData != null) { |
| 132 ClosureFieldElement thisLocal = closureData.thisFieldEntity; | 132 ClosureFieldElement thisLocal = closureData.thisFieldEntity; |
| 133 assert(thisLocal != null); | 133 if (thisLocal != null) { |
| 134 jsAst.Name thisName = _namer.instanceFieldPropertyName(thisLocal); | 134 jsAst.Name thisName = _namer.instanceFieldPropertyName(thisLocal); |
| 135 thisAccess = js('this.#', thisName); | 135 thisAccess = js('this.#', thisName); |
| 136 } |
| 136 } | 137 } |
| 137 } | 138 } |
| 138 | 139 |
| 139 if (storeFunctionTypeInMetadata && !type.containsTypeVariables) { | 140 if (storeFunctionTypeInMetadata && !type.containsTypeVariables) { |
| 140 result.functionTypeIndex = | 141 result.functionTypeIndex = |
| 141 emitterTask.metadataCollector.reifyType(type); | 142 emitterTask.metadataCollector.reifyType(type); |
| 142 } else { | 143 } else { |
| 143 jsAst.Expression encoding = _rtiEncoder.getSignatureEncoding( | 144 jsAst.Expression encoding = _rtiEncoder.getSignatureEncoding( |
| 144 emitterTask.emitter, type, thisAccess); | 145 emitterTask.emitter, type, thisAccess); |
| 145 jsAst.Name operatorSignature = _namer.asName(_namer.operatorSignature); | 146 jsAst.Name operatorSignature = _namer.asName(_namer.operatorSignature); |
| (...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 340 | 341 |
| 341 // We need to also emit "is checks" for the superclass and its supertypes. | 342 // We need to also emit "is checks" for the superclass and its supertypes. |
| 342 ClassElement superclass = cls.superclass; | 343 ClassElement superclass = cls.superclass; |
| 343 if (superclass != null) { | 344 if (superclass != null) { |
| 344 tryEmitTest(superclass); | 345 tryEmitTest(superclass); |
| 345 _generateInterfacesIsTests( | 346 _generateInterfacesIsTests( |
| 346 superclass, generateIsTest, generateSubstitution, alreadyGenerated); | 347 superclass, generateIsTest, generateSubstitution, alreadyGenerated); |
| 347 } | 348 } |
| 348 } | 349 } |
| 349 } | 350 } |
| OLD | NEW |