This closes #470 issue on Github.
njs_value_t *retval;
njs_function_t *function;
- retval = njs_scope_valid_value(vm, retidx);
+ retval = njs_scope_value(vm, retidx);
- if (njs_is_undefined(retval)) {
+ if (!njs_is_valid(retval)) {
*retval = *value;
function = njs_function_value_copy(vm, retval);
"c()()()"),
njs_str("1") },
-#if 0
{ njs_str("function f() {}; f += 1; f"),
njs_str("[object Function]1") },
-#endif
+
+ { njs_str("function f() { function g() { g = undefined; }; g(); g(); };"
+ "f()"),
+ njs_str("TypeError: undefined is not a function") },
{ njs_str("function f() {}; function g() { return f }; g()"),
njs_str("[object Function]") },