From 1c01ffc3d49a910445c86b76999cd62531ab3e91 Mon Sep 17 00:00:00 2001 From: André Aparício Date: Mon, 16 Jul 2012 21:38:28 +0100 Subject: Walker: Support local declaration inside eval --- bashast/libbashWalker.g | 2 +- scripts/var_def.bash | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/bashast/libbashWalker.g b/bashast/libbashWalker.g index 42a8917..44cb4c2 100644 --- a/bashast/libbashWalker.g +++ b/bashast/libbashWalker.g @@ -650,7 +650,7 @@ execute_command[std::string& name, std::vector& libbash_args] bool redirection = false; } @init { - if(name != "local" && name != "set" && name != "declare") + if(name != "local" && name != "set" && name != "declare" && name != "eval") current_scope.reset(new interpreter::local_scope(*walker)); } :var_def[true]* (redirect[out, err, in]{ redirection = true; })* { diff --git a/scripts/var_def.bash b/scripts/var_def.bash index b0224f1..fb6550d 100644 --- a/scripts/var_def.bash +++ b/scripts/var_def.bash @@ -85,12 +85,15 @@ echo $FOO005 function foo() { local -i foo=1 local -a bar=(1 2 3) + eval local foobar=23 echo $foo echo ${bar[@]} + echo foobar } foo bar=@ echo $bar +echo $foobar ARRAY11=(1 2 3 [10]=15) ARRAY11+=(1 [15]=20) echo ${ARRAY11[@]} -- cgit v1.2.3-65-gdbad