mirror of
https://github.com/jerryscript-project/jerryscript.git
synced 2025-12-15 16:29:21 +00:00
Parse undefined as simple
This commit is contained in:
parent
6561c3fe6c
commit
c8b97214fe
@ -486,6 +486,14 @@ decode_keyword (void)
|
||||
.uid = KW_RESERVED
|
||||
};
|
||||
}
|
||||
if (current_token_equals_to ("undefined"))
|
||||
{
|
||||
return (token)
|
||||
{
|
||||
.type = TOK_UNDEFINED,
|
||||
.uid = 0
|
||||
};
|
||||
}
|
||||
return empty_token;
|
||||
}
|
||||
|
||||
|
||||
@ -131,7 +131,8 @@ typedef uint8_t token_type;
|
||||
|
||||
#define TOK_DIV 55 // /
|
||||
#define TOK_DIV_EQ 56 // /=
|
||||
#define TOK_EMPTY 57
|
||||
#define TOK_UNDEFINED 57 // undefined
|
||||
#define TOK_EMPTY 58
|
||||
|
||||
|
||||
/* Represents the contents of a token. */
|
||||
|
||||
@ -1221,6 +1221,12 @@ parse_primary_expression (void)
|
||||
STACK_PUSH (IDX, token_data ());
|
||||
break;
|
||||
}
|
||||
case TOK_UNDEFINED:
|
||||
{
|
||||
STACK_PUSH (IDX, next_temp_name ());
|
||||
DUMP_OPCODE_3 (assignment, ID(1), OPCODE_ARG_TYPE_SIMPLE, ECMA_SIMPLE_VALUE_UNDEFINED);
|
||||
break;
|
||||
}
|
||||
case TOK_NULL:
|
||||
case TOK_BOOL:
|
||||
case TOK_SMALL_INT:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user