aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMu Qiao <qiaomuf@gentoo.org>2011-06-07 22:31:38 +0800
committerPetteri Räty <petsku@petteriraty.eu>2011-06-09 14:41:23 +0300
commiteb40afee7b3edcf29779ea2f9ce59d4457322061 (patch)
tree616ce2d405b8c4b62cb740d48cc33674400edc3e /scripts
parentCore: remove unnecessary include (diff)
downloadlibbash-eb40afee7b3edcf29779ea2f9ce59d4457322061.tar.gz
libbash-eb40afee7b3edcf29779ea2f9ce59d4457322061.tar.bz2
libbash-eb40afee7b3edcf29779ea2f9ce59d4457322061.zip
Core: fix function handling
When there handle multiple input files (for example, source built-in is called while interpreting), there will be multiple token streams. Then the function index might not be correct as we don't know which stream the function belongs to. Now both the AST and the function index are stored to execute the function at the right index in the right stream. Using single libbashWalker and changing the pointer of the ctns is not working. The reason might be the internal data structures of libbashWalker are broken after the function call. So a new libbashWalker is created every time a function call is made. The current AST is saved in std::stack because new functions may be defined during a function call.
Diffstat (limited to 'scripts')
-rw-r--r--scripts/source_true.sh2
1 files changed, 1 insertions, 1 deletions
diff --git a/scripts/source_true.sh b/scripts/source_true.sh
index aecb607..a848f2e 100644
--- a/scripts/source_true.sh
+++ b/scripts/source_true.sh
@@ -1,6 +1,6 @@
FOO001=hello
function foo()
{
- :
+ echo hi
}
FOO002=$0