| OLD | NEW |
| 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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 import '../closure.dart'; | 5 import '../closure.dart'; |
| 6 import '../common.dart'; | 6 import '../common.dart'; |
| 7 import '../compiler.dart' show Compiler; | 7 import '../compiler.dart' show Compiler; |
| 8 import '../elements/resolution_types.dart'; | 8 import '../elements/resolution_types.dart'; |
| 9 import '../elements/elements.dart'; | 9 import '../elements/elements.dart'; |
| 10 import '../elements/entities.dart'; | 10 import '../elements/entities.dart'; |
| (...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 244 | 244 |
| 245 // If this method is an intercepted method, add the extra | 245 // If this method is an intercepted method, add the extra |
| 246 // parameter to it, that is the actual receiver for intercepted | 246 // parameter to it, that is the actual receiver for intercepted |
| 247 // classes, or the same as [:this:] for non-intercepted classes. | 247 // classes, or the same as [:this:] for non-intercepted classes. |
| 248 ClassElement cls = element.enclosingClass; | 248 ClassElement cls = element.enclosingClass; |
| 249 | 249 |
| 250 // When the class extends a native class, the instance is pre-constructed | 250 // When the class extends a native class, the instance is pre-constructed |
| 251 // and passed to the generative constructor factory function as a parameter. | 251 // and passed to the generative constructor factory function as a parameter. |
| 252 // Instead of allocating and initializing the object, the constructor | 252 // Instead of allocating and initializing the object, the constructor |
| 253 // 'upgrades' the native subclass object by initializing the Dart fields. | 253 // 'upgrades' the native subclass object by initializing the Dart fields. |
| 254 bool isNativeUpgradeFactory = | 254 bool isNativeUpgradeFactory = element.isGenerativeConstructor && |
| 255 element.isGenerativeConstructor && backend.isNativeOrExtendsNative(cls); | 255 backend.nativeData.isNativeOrExtendsNative(cls); |
| 256 if (backend.isInterceptedMethod(element)) { | 256 if (backend.interceptorData.isInterceptedMethod(element)) { |
| 257 bool isInterceptorClass = backend.isInterceptorClass(cls.declaration); | 257 bool isInterceptorClass = |
| 258 backend.interceptorData.isInterceptorClass(cls.declaration); |
| 258 String name = isInterceptorClass ? 'receiver' : '_'; | 259 String name = isInterceptorClass ? 'receiver' : '_'; |
| 259 SyntheticLocal parameter = new SyntheticLocal(name, executableContext); | 260 SyntheticLocal parameter = new SyntheticLocal(name, executableContext); |
| 260 HParameterValue value = new HParameterValue(parameter, getTypeOfThis()); | 261 HParameterValue value = new HParameterValue(parameter, getTypeOfThis()); |
| 261 builder.graph.explicitReceiverParameter = value; | 262 builder.graph.explicitReceiverParameter = value; |
| 262 builder.graph.entry.addAfter(directLocals[closureData.thisLocal], value); | 263 builder.graph.entry.addAfter(directLocals[closureData.thisLocal], value); |
| 263 if (builder.lastAddedParameter == null) { | 264 if (builder.lastAddedParameter == null) { |
| 264 // If this is the first parameter inserted, make sure it stays first. | 265 // If this is the first parameter inserted, make sure it stays first. |
| 265 builder.lastAddedParameter = value; | 266 builder.lastAddedParameter = value; |
| 266 } | 267 } |
| 267 if (isInterceptorClass) { | 268 if (isInterceptorClass) { |
| (...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 669 final int hashCode = _nextHashCode = (_nextHashCode + 1).toUnsigned(30); | 670 final int hashCode = _nextHashCode = (_nextHashCode + 1).toUnsigned(30); |
| 670 static int _nextHashCode = 0; | 671 static int _nextHashCode = 0; |
| 671 | 672 |
| 672 SyntheticLocal(this.name, this.executableContext); | 673 SyntheticLocal(this.name, this.executableContext); |
| 673 | 674 |
| 674 @override | 675 @override |
| 675 MemberElement get memberContext => executableContext.memberContext; | 676 MemberElement get memberContext => executableContext.memberContext; |
| 676 | 677 |
| 677 toString() => 'SyntheticLocal($name)'; | 678 toString() => 'SyntheticLocal($name)'; |
| 678 } | 679 } |
| OLD | NEW |