summaryrefslogtreecommitdiff
path: root/source4/lib/ejs
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2005-05-31 01:48:04 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:17:20 -0500
commit999d0eb6e866c8027c0e1197a58d229f1e14f37e (patch)
tree4e1c35f1e5d2dd53376974b3f3719f6eea8788f2 /source4/lib/ejs
parent509e57995c535db09b84c3e0efb4d33c5822e289 (diff)
downloadsamba-999d0eb6e866c8027c0e1197a58d229f1e14f37e.tar.gz
samba-999d0eb6e866c8027c0e1197a58d229f1e14f37e.tar.bz2
samba-999d0eb6e866c8027c0e1197a58d229f1e14f37e.zip
r7127: allow for recursive ejs functions
(This used to be commit 567bb9568c4e46a4abf9250e7319c702fc3a2fc9)
Diffstat (limited to 'source4/lib/ejs')
-rw-r--r--source4/lib/ejs/ejsParser.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/source4/lib/ejs/ejsParser.c b/source4/lib/ejs/ejsParser.c
index d42d66bcf5..17fe0ce98a 100644
--- a/source4/lib/ejs/ejsParser.c
+++ b/source4/lib/ejs/ejsParser.c
@@ -1128,6 +1128,13 @@ static int parseFunctionDec(Ejs *ep, int state, int flags)
mprDestroyVar(&v);
return EJS_STATE_ERR;
}
+
+ /* register the function name early to allow for recursive
+ function calls (see note in ECMA standard, page 71) */
+ if (!(flags & EJS_FLAGS_ASSIGNMENT)) {
+ currentObj = ejsFindObj(ep, 0, procName, flags);
+ vp = mprSetProperty(currentObj, procName, &v);
+ }
/*
* Parse the function body. Turn execute off.