OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "tools/gn/err.h" | 5 #include "tools/gn/err.h" |
6 #include "tools/gn/functions.h" | 6 #include "tools/gn/functions.h" |
7 #include "tools/gn/parse_node_value_adapter.h" | 7 #include "tools/gn/parse_node_value_adapter.h" |
8 #include "tools/gn/parse_tree.h" | 8 #include "tools/gn/parse_tree.h" |
9 #include "tools/gn/scope.h" | 9 #include "tools/gn/scope.h" |
10 | 10 |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 scope->SetValue(loop_var, cur, function); | 88 scope->SetValue(loop_var, cur, function); |
89 block->Execute(scope, err); | 89 block->Execute(scope, err); |
90 if (err->has_error()) | 90 if (err->has_error()) |
91 return Value(); | 91 return Value(); |
92 } | 92 } |
93 | 93 |
94 // Put back loop var. | 94 // Put back loop var. |
95 if (old_loop_value_ptr) { | 95 if (old_loop_value_ptr) { |
96 // Put back old value. Use the copy we made, rather than use the pointer, | 96 // Put back old value. Use the copy we made, rather than use the pointer, |
97 // which will probably point to the new value now in the scope. | 97 // which will probably point to the new value now in the scope. |
98 scope->SetValue(loop_var, old_loop_value, old_loop_value.origin()); | 98 scope->SetValue(loop_var, std::move(old_loop_value), |
| 99 old_loop_value.origin()); |
99 } else { | 100 } else { |
100 // Loop variable was undefined before loop, delete it. | 101 // Loop variable was undefined before loop, delete it. |
101 scope->RemoveIdentifier(loop_var); | 102 scope->RemoveIdentifier(loop_var); |
102 } | 103 } |
103 | 104 |
104 return Value(); | 105 return Value(); |
105 } | 106 } |
106 | 107 |
107 } // namespace functions | 108 } // namespace functions |
OLD | NEW |