summaryrefslogtreecommitdiff
path: root/source4/lib/ejs
diff options
context:
space:
mode:
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.