| 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 |
| 9 ClosureRepresentationInfo, |
| 10 ClosureFieldElement, |
| 11 ClosureConversionTask, |
| 12 ScopeInfo; |
| 9 import '../common.dart'; | 13 import '../common.dart'; |
| 10 import '../common/names.dart' show Identifiers; | 14 import '../common/names.dart' show Identifiers; |
| 11 import '../common_elements.dart' show CommonElements, ElementEnvironment; | 15 import '../common_elements.dart' show CommonElements, ElementEnvironment; |
| 12 import '../elements/elements.dart' | 16 import '../elements/elements.dart' |
| 13 show ClassElement, MethodElement, MixinApplicationElement; | 17 show ClassElement, MethodElement, MixinApplicationElement; |
| 14 import '../elements/entities.dart'; | 18 import '../elements/entities.dart'; |
| 15 import '../elements/types.dart'; | 19 import '../elements/types.dart'; |
| 16 import '../js/js.dart' as jsAst; | 20 import '../js/js.dart' as jsAst; |
| 17 import '../js/js.dart' show js; | 21 import '../js/js.dart' show js; |
| 18 import '../js_backend/js_interop_analysis.dart'; | 22 import '../js_backend/js_interop_analysis.dart'; |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 !_closedWorld.isSubclassOf(classElement, other)) { | 171 !_closedWorld.isSubclassOf(classElement, other)) { |
| 168 result.addIsTest(other, _namer.operatorIs(other), js('1')); | 172 result.addIsTest(other, _namer.operatorIs(other), js('1')); |
| 169 } | 173 } |
| 170 } | 174 } |
| 171 | 175 |
| 172 void generateFunctionTypeSignature( | 176 void generateFunctionTypeSignature( |
| 173 FunctionEntity method, FunctionType type) { | 177 FunctionEntity method, FunctionType type) { |
| 174 assert(!(method is MethodElement && !method.isImplementation)); | 178 assert(!(method is MethodElement && !method.isImplementation)); |
| 175 jsAst.Expression thisAccess = new jsAst.This(); | 179 jsAst.Expression thisAccess = new jsAst.This(); |
| 176 if (!method.isAbstract) { | 180 if (!method.isAbstract) { |
| 177 ClosureRepresentationInfo closureData = | 181 ScopeInfo scopeInfo = _closureDataLookup.getScopeInfo(method); |
| 178 _closureDataLookup.getClosureInfoForMember(method); | 182 if (scopeInfo is ClosureRepresentationInfo) { |
| 179 if (closureData != null) { | 183 ClosureFieldElement thisLocal = scopeInfo.thisFieldEntity; |
| 180 ClosureFieldElement thisLocal = closureData.thisFieldEntity; | |
| 181 if (thisLocal != null) { | 184 if (thisLocal != null) { |
| 182 jsAst.Name thisName = _namer.instanceFieldPropertyName(thisLocal); | 185 jsAst.Name thisName = _namer.instanceFieldPropertyName(thisLocal); |
| 183 thisAccess = js('this.#', thisName); | 186 thisAccess = js('this.#', thisName); |
| 184 } | 187 } |
| 185 } | 188 } |
| 186 } | 189 } |
| 187 | 190 |
| 188 if (storeFunctionTypeInMetadata && !type.containsTypeVariables) { | 191 if (storeFunctionTypeInMetadata && !type.containsTypeVariables) { |
| 189 result.functionTypeIndex = | 192 result.functionTypeIndex = |
| 190 emitterTask.metadataCollector.reifyType(type); | 193 emitterTask.metadataCollector.reifyType(type); |
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 389 | 392 |
| 390 // We need to also emit "is checks" for the superclass and its supertypes. | 393 // We need to also emit "is checks" for the superclass and its supertypes. |
| 391 ClassEntity superclass = _elementEnvironment.getSuperClass(cls); | 394 ClassEntity superclass = _elementEnvironment.getSuperClass(cls); |
| 392 if (superclass != null) { | 395 if (superclass != null) { |
| 393 tryEmitTest(superclass); | 396 tryEmitTest(superclass); |
| 394 _generateInterfacesIsTests( | 397 _generateInterfacesIsTests( |
| 395 superclass, generateIsTest, generateSubstitution, alreadyGenerated); | 398 superclass, generateIsTest, generateSubstitution, alreadyGenerated); |
| 396 } | 399 } |
| 397 } | 400 } |
| 398 } | 401 } |
| OLD | NEW |