diff options
author | Mu Qiao <qiaomuf@gentoo.org> | 2011-07-26 19:35:47 +0800 |
---|---|---|
committer | Mu Qiao <qiaomuf@gentoo.org> | 2011-08-02 15:52:18 +0800 |
commit | 8a4182d62b11c5b878ab2b15f1ad4d01e6544ecc (patch) | |
tree | 8d90b1a0bd2acd24dc0dad660e9fc0ad3625f0c8 | |
parent | Parser: fix here document start (diff) | |
download | libbash-8a4182d62b11c5b878ab2b15f1ad4d01e6544ecc.tar.gz libbash-8a4182d62b11c5b878ab2b15f1ad4d01e6544ecc.tar.bz2 libbash-8a4182d62b11c5b878ab2b15f1ad4d01e6544ecc.zip |
Core: do not declare $* to be read-only
$* can be shifted so it's not read-only.
-rw-r--r-- | scripts/function_def.bash | 7 | ||||
-rw-r--r-- | src/core/interpreter.cpp | 2 |
2 files changed, 8 insertions, 1 deletions
diff --git a/scripts/function_def.bash b/scripts/function_def.bash index 8b7bd50..609d8b4 100644 --- a/scripts/function_def.bash +++ b/scripts/function_def.bash @@ -87,3 +87,10 @@ if false; then } fi function_in_compound_statement + +function shift_test() { + shift + echo $1 +} + +shift_test 1 2 diff --git a/src/core/interpreter.cpp b/src/core/interpreter.cpp index a92bea3..b048353 100644 --- a/src/core/interpreter.cpp +++ b/src/core/interpreter.cpp @@ -309,7 +309,7 @@ void interpreter::define_function_arguments(scope& current_stack, for(auto i = 1u; i <= arguments.size(); ++i) positional_args[i] = arguments[i - 1]; - current_stack["*"].reset(new variable("*", positional_args, true)); + current_stack["*"].reset(new variable("*", positional_args)); } namespace |