From 999d0eb6e866c8027c0e1197a58d229f1e14f37e Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Tue, 31 May 2005 01:48:04 +0000 Subject: r7127: allow for recursive ejs functions (This used to be commit 567bb9568c4e46a4abf9250e7319c702fc3a2fc9) --- source4/lib/ejs/ejsParser.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'source4/lib/ejs') 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. -- cgit