| 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 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 ClassElement checkedClass = check.cls; | 170 ClassElement checkedClass = check.cls; |
| 171 generateIsTest(checkedClass); | 171 generateIsTest(checkedClass); |
| 172 Substitution substitution = check.substitution; | 172 Substitution substitution = check.substitution; |
| 173 if (substitution != null) { | 173 if (substitution != null) { |
| 174 jsAst.Expression body = | 174 jsAst.Expression body = |
| 175 _rtiEncoder.getSubstitutionCode(emitterTask.emitter, substitution); | 175 _rtiEncoder.getSubstitutionCode(emitterTask.emitter, substitution); |
| 176 result.properties[_namer.substitutionName(checkedClass)] = body; | 176 result.properties[_namer.substitutionName(checkedClass)] = body; |
| 177 } | 177 } |
| 178 } | 178 } |
| 179 | 179 |
| 180 _generateIsTestsOn(classElement, generateIsTest, | 180 _generateIsTestsOn(classElement, (Element e) { |
| 181 generateFunctionTypeSignature, generateSubstitution, generateTypeCheck); | 181 generateIsTest(e); |
| 182 }, (Element e, ResolutionFunctionType t) { |
| 183 generateFunctionTypeSignature(e, t); |
| 184 }, |
| 185 (Element e, {bool emitNull: false}) => |
| 186 generateSubstitution(e, emitNull: emitNull), |
| 187 generateTypeCheck); |
| 182 | 188 |
| 183 if (classElement == _commonElements.jsJavaScriptFunctionClass) { | 189 if (classElement == _commonElements.jsJavaScriptFunctionClass) { |
| 184 var type = _jsInteropAnalysis.buildJsFunctionType(); | 190 var type = _jsInteropAnalysis.buildJsFunctionType(); |
| 185 if (type != null) { | 191 if (type != null) { |
| 186 jsAst.Expression thisAccess = new jsAst.This(); | 192 jsAst.Expression thisAccess = new jsAst.This(); |
| 187 jsAst.Expression encoding = _rtiEncoder.getSignatureEncoding( | 193 jsAst.Expression encoding = _rtiEncoder.getSignatureEncoding( |
| 188 emitterTask.emitter, type, thisAccess); | 194 emitterTask.emitter, type, thisAccess); |
| 189 jsAst.Name operatorSignature = _namer.asName(_namer.operatorSignature); | 195 jsAst.Name operatorSignature = _namer.asName(_namer.operatorSignature); |
| 190 result.properties[operatorSignature] = encoding; | 196 result.properties[operatorSignature] = encoding; |
| 191 } | 197 } |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 334 | 340 |
| 335 // 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. |
| 336 ClassElement superclass = cls.superclass; | 342 ClassElement superclass = cls.superclass; |
| 337 if (superclass != null) { | 343 if (superclass != null) { |
| 338 tryEmitTest(superclass); | 344 tryEmitTest(superclass); |
| 339 _generateInterfacesIsTests( | 345 _generateInterfacesIsTests( |
| 340 superclass, generateIsTest, generateSubstitution, alreadyGenerated); | 346 superclass, generateIsTest, generateSubstitution, alreadyGenerated); |
| 341 } | 347 } |
| 342 } | 348 } |
| 343 } | 349 } |
| OLD | NEW |