aboutsummaryrefslogtreecommitdiffhomepage
path: root/parse_execution.cpp
diff options
context:
space:
mode:
authorGravatar ridiculousfish <corydoras@ridiculousfish.com>2014-02-21 18:20:51 -0800
committerGravatar ridiculousfish <corydoras@ridiculousfish.com>2014-02-21 18:20:51 -0800
commitbc4340962480cc7e9d18a2057ca180f6380476cc (patch)
tree672b450c2b43abb03abece7137cd3593b6c78f88 /parse_execution.cpp
parenta57077aba3780e011783bbd27485fd8c4eadfad0 (diff)
Expand the variable name as an ordinary parameter in for loops. Added
test for it too.
Diffstat (limited to 'parse_execution.cpp')
-rw-r--r--parse_execution.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/parse_execution.cpp b/parse_execution.cpp
index f2eaae25..726f2920 100644
--- a/parse_execution.cpp
+++ b/parse_execution.cpp
@@ -436,9 +436,14 @@ parse_execution_result_t parse_execution_context_t::run_for_statement(const pars
assert(header.type == symbol_for_header);
assert(block_contents.type == symbol_job_list);
- /* Get the variable name: `for var_name in ...` */
+ /* Get the variable name: `for var_name in ...`. We expand the variable name. It better result in just one. */
const parse_node_t &var_name_node = *get_child(header, 1, parse_token_type_string);
- const wcstring for_var_name = get_source(var_name_node);
+ wcstring for_var_name = get_source(var_name_node);
+ if (! expand_one(for_var_name, 0))
+ {
+ report_error(var_name_node, FAILED_EXPANSION_VARIABLE_NAME_ERR_MSG, for_var_name.c_str());
+ return parse_execution_errored;
+ }
/* Get the contents to iterate over. */
const parse_node_t *unmatched_wildcard = NULL;