aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMu Qiao <qiaomuf@gentoo.org>2011-07-26 19:35:47 +0800
committerMu Qiao <qiaomuf@gentoo.org>2011-08-02 15:52:18 +0800
commit8a4182d62b11c5b878ab2b15f1ad4d01e6544ecc (patch)
tree8d90b1a0bd2acd24dc0dad660e9fc0ad3625f0c8
parentParser: fix here document start (diff)
downloadlibbash-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.bash7
-rw-r--r--src/core/interpreter.cpp2
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