static nxt_int_t
njs_generate_name(njs_vm_t *vm, njs_parser_t *parser, njs_parser_node_t *node)
{
- njs_index_t index;
- njs_value_t *value;
njs_vmcode_object_copy_t *copy;
- index = node->u.variable->index;
- value = njs_variable_value(parser, index);
-
- if (value->type == NJS_FUNCTION) {
+ if (node->u.variable->function) {
node->index = njs_generator_dest_index(vm, parser, node);
if (nxt_slow_path(node->index == NJS_INDEX_ERROR)) {
copy->code.operands = NJS_VMCODE_2OPERANDS;
copy->code.retval = NJS_VMCODE_RETVAL;
copy->retval = node->index;
- copy->object = index;
+ copy->object = node->u.variable->index;
return NXT_OK;
}
typedef struct {
u_char *name_start;
uint16_t name_len;
- njs_variable_state_t state:8; /* 3 bits */
+ njs_variable_state_t state:8; /* 3 bits */
+ uint8_t function; /* 1 bit */
njs_index_t index;
} njs_variable_t;