stop->code.retval = NJS_VMCODE_NO_RETVAL;
index = NJS_INDEX_NONE;
+ node = node->right;
- if (node->right != NULL) {
- index = node->right->index;
+ if (node != NULL && node->token != NJS_TOKEN_FUNCTION) {
+ index = node->index;
}
if (index == NJS_INDEX_NONE) {
{ nxt_string("function () { } f()"),
nxt_string("SyntaxError: Unexpected token \"(\" in 1") },
+ { nxt_string("function f() { }"),
+ nxt_string("undefined") },
+
+ { nxt_string("var x; function f() { }"),
+ nxt_string("undefined") },
+
{ nxt_string("function f() { } f()"),
nxt_string("undefined") },