diff options
author | 2012-07-16 21:38:28 +0100 | |
---|---|---|
committer | 2012-07-20 09:20:22 +0800 | |
commit | 1c01ffc3d49a910445c86b76999cd62531ab3e91 (patch) | |
tree | 9279b0ed8edad49cf6a1b94ed588c55d3c33a508 | |
parent | Parser: Support line continuation inside keyword test (diff) | |
download | libbash-1c01ffc3d49a910445c86b76999cd62531ab3e91.tar.gz libbash-1c01ffc3d49a910445c86b76999cd62531ab3e91.tar.bz2 libbash-1c01ffc3d49a910445c86b76999cd62531ab3e91.zip |
Walker: Support local declaration inside eval
-rw-r--r-- | bashast/libbashWalker.g | 2 | ||||
-rw-r--r-- | scripts/var_def.bash | 3 |
2 files changed, 4 insertions, 1 deletions
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<std::string>& 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[@]} |