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 != null) { | 131 if (closureData.isClosure && closureData.thisLocal != null) { |
Siggi Cherem (dart-lang)
2017/06/20 00:30:22
is closureData never null now? Will it ever be the
| |
132 ClosureFieldElement thisLocal = closureData.thisFieldEntity; | 132 ClosureFieldElement thisLocal = closureData.thisFieldEntity; |
133 if (thisLocal != null) { | 133 assert(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 } | |
137 } | 136 } |
138 } | 137 } |
139 | 138 |
140 if (storeFunctionTypeInMetadata && !type.containsTypeVariables) { | 139 if (storeFunctionTypeInMetadata && !type.containsTypeVariables) { |
141 result.functionTypeIndex = | 140 result.functionTypeIndex = |
142 emitterTask.metadataCollector.reifyType(type); | 141 emitterTask.metadataCollector.reifyType(type); |
143 } else { | 142 } else { |
144 jsAst.Expression encoding = _rtiEncoder.getSignatureEncoding( | 143 jsAst.Expression encoding = _rtiEncoder.getSignatureEncoding( |
145 emitterTask.emitter, type, thisAccess); | 144 emitterTask.emitter, type, thisAccess); |
146 jsAst.Name operatorSignature = _namer.asName(_namer.operatorSignature); | 145 jsAst.Name operatorSignature = _namer.asName(_namer.operatorSignature); |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
341 | 340 |
342 // We need to also emit "is checks" for the superclass and its supertypes. | 341 // We need to also emit "is checks" for the superclass and its supertypes. |
343 ClassElement superclass = cls.superclass; | 342 ClassElement superclass = cls.superclass; |
344 if (superclass != null) { | 343 if (superclass != null) { |
345 tryEmitTest(superclass); | 344 tryEmitTest(superclass); |
346 _generateInterfacesIsTests( | 345 _generateInterfacesIsTests( |
347 superclass, generateIsTest, generateSubstitution, alreadyGenerated); | 346 superclass, generateIsTest, generateSubstitution, alreadyGenerated); |
348 } | 347 } |
349 } | 348 } |
350 } | 349 } |
OLD | NEW |