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 '../io/source_information.dart'; | 10 import '../io/source_information.dart'; |
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
269 } | 269 } |
270 } else if (isNativeUpgradeFactory) { | 270 } else if (isNativeUpgradeFactory) { |
271 SyntheticLocal parameter = | 271 SyntheticLocal parameter = |
272 new SyntheticLocal('receiver', executableContext); | 272 new SyntheticLocal('receiver', executableContext); |
273 // Unlike `this`, receiver is nullable since direct calls to generative | 273 // Unlike `this`, receiver is nullable since direct calls to generative |
274 // constructor call the constructor with `null`. | 274 // constructor call the constructor with `null`. |
275 HParameterValue value = | 275 HParameterValue value = |
276 new HParameterValue(parameter, new TypeMask.exact(cls, closedWorld)); | 276 new HParameterValue(parameter, new TypeMask.exact(cls, closedWorld)); |
277 builder.graph.explicitReceiverParameter = value; | 277 builder.graph.explicitReceiverParameter = value; |
278 builder.graph.entry.addAtEntry(value); | 278 builder.graph.entry.addAtEntry(value); |
| 279 if (builder.lastAddedParameter == null) { |
| 280 // If this is the first parameter inserted, make sure it stays first. |
| 281 builder.lastAddedParameter = value; |
| 282 } |
279 } | 283 } |
280 } | 284 } |
281 | 285 |
282 /// Returns true if the local can be accessed directly. Boxed variables or | 286 /// Returns true if the local can be accessed directly. Boxed variables or |
283 /// captured variables that are stored in the closure-field return [:false:]. | 287 /// captured variables that are stored in the closure-field return [:false:]. |
284 bool isAccessedDirectly(Local local) { | 288 bool isAccessedDirectly(Local local) { |
285 assert(local != null); | 289 assert(local != null); |
286 return !redirectionMapping.containsKey(local) && | 290 return !redirectionMapping.containsKey(local) && |
287 !closureData.variablesUsedInTryOrGenerator.contains(local); | 291 !closureData.variablesUsedInTryOrGenerator.contains(local); |
288 } | 292 } |
(...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
662 final ExecutableElement executableContext; | 666 final ExecutableElement executableContext; |
663 | 667 |
664 // Avoid slow Object.hashCode. | 668 // Avoid slow Object.hashCode. |
665 final int hashCode = _nextHashCode = (_nextHashCode + 1).toUnsigned(30); | 669 final int hashCode = _nextHashCode = (_nextHashCode + 1).toUnsigned(30); |
666 static int _nextHashCode = 0; | 670 static int _nextHashCode = 0; |
667 | 671 |
668 SyntheticLocal(this.name, this.executableContext); | 672 SyntheticLocal(this.name, this.executableContext); |
669 | 673 |
670 toString() => 'SyntheticLocal($name)'; | 674 toString() => 'SyntheticLocal($name)'; |
671 } | 675 } |
OLD | NEW |