Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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.ir_builder; | 5 library dart2js.ir_builder; |
| 6 | 6 |
| 7 import '../closure.dart' hide ClosureScope; | 7 import '../closure.dart' hide ClosureScope; |
| 8 import '../common.dart'; | 8 import '../common.dart'; |
| 9 import '../common/names.dart' show | 9 import '../common/names.dart' show |
| 10 Names, | 10 Names, |
| (...skipping 2517 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2528 List<LocalElement> loopVariables) { | 2528 List<LocalElement> loopVariables) { |
| 2529 if (scope == null) return; | 2529 if (scope == null) return; |
| 2530 // If there are no boxed loop variables, then the box is created inside the | 2530 // If there are no boxed loop variables, then the box is created inside the |
| 2531 // body, so there is no need to explicitly renew it. | 2531 // body, so there is no need to explicitly renew it. |
| 2532 if (scope.boxedLoopVariables.isEmpty) return; | 2532 if (scope.boxedLoopVariables.isEmpty) return; |
| 2533 ir.Primitive box = environment.lookup(scope.box); | 2533 ir.Primitive box = environment.lookup(scope.box); |
| 2534 ir.Primitive newBox = addPrimitive(new ir.CreateBox()); | 2534 ir.Primitive newBox = addPrimitive(new ir.CreateBox()); |
| 2535 newBox.useElementAsHint(scope.box); | 2535 newBox.useElementAsHint(scope.box); |
| 2536 for (VariableElement loopVar in scope.boxedLoopVariables) { | 2536 for (VariableElement loopVar in scope.boxedLoopVariables) { |
| 2537 ClosureLocation location = scope.capturedVariables[loopVar]; | 2537 ClosureLocation location = scope.capturedVariables[loopVar]; |
| 2538 if (location == null) continue; | |
|
Siggi Cherem (dart-lang)
2015/10/23 01:39:58
I'm not certain that this is the right fix. What I
asgerf
2015/10/23 09:37:30
'n' is captured but not boxed, so it's absurd that
| |
| 2538 ir.Primitive value = addPrimitive(new ir.GetField(box, location.field)); | 2539 ir.Primitive value = addPrimitive(new ir.GetField(box, location.field)); |
| 2539 addPrimitive(new ir.SetField(newBox, location.field, value)); | 2540 addPrimitive(new ir.SetField(newBox, location.field, value)); |
| 2540 } | 2541 } |
| 2541 environment.update(scope.box, newBox); | 2542 environment.update(scope.box, newBox); |
| 2542 } | 2543 } |
| 2543 | 2544 |
| 2544 /// Creates an access to the receiver from the current (or enclosing) method. | 2545 /// Creates an access to the receiver from the current (or enclosing) method. |
| 2545 /// | 2546 /// |
| 2546 /// If inside a closure class, [buildThis] will redirect access through | 2547 /// If inside a closure class, [buildThis] will redirect access through |
| 2547 /// closure fields in order to access the receiver from the enclosing method. | 2548 /// closure fields in order to access the receiver from the enclosing method. |
| (...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2886 } | 2887 } |
| 2887 | 2888 |
| 2888 class SwitchCaseInfo { | 2889 class SwitchCaseInfo { |
| 2889 final List<ir.Primitive> constants = <ir.Primitive>[]; | 2890 final List<ir.Primitive> constants = <ir.Primitive>[]; |
| 2890 final SubbuildFunction buildBody; | 2891 final SubbuildFunction buildBody; |
| 2891 | 2892 |
| 2892 SwitchCaseInfo(this.buildBody); | 2893 SwitchCaseInfo(this.buildBody); |
| 2893 | 2894 |
| 2894 void addConstant(ir.Primitive constant) => constants.add(constant); | 2895 void addConstant(ir.Primitive constant) => constants.add(constant); |
| 2895 } | 2896 } |
| OLD | NEW |