Parse undefined as simple
This commit is contained in:
@@ -486,6 +486,14 @@ decode_keyword (void)
|
|||||||
.uid = KW_RESERVED
|
.uid = KW_RESERVED
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
if (current_token_equals_to ("undefined"))
|
||||||
|
{
|
||||||
|
return (token)
|
||||||
|
{
|
||||||
|
.type = TOK_UNDEFINED,
|
||||||
|
.uid = 0
|
||||||
|
};
|
||||||
|
}
|
||||||
return empty_token;
|
return empty_token;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -131,7 +131,8 @@ typedef uint8_t token_type;
|
|||||||
|
|
||||||
#define TOK_DIV 55 // /
|
#define TOK_DIV 55 // /
|
||||||
#define TOK_DIV_EQ 56 // /=
|
#define TOK_DIV_EQ 56 // /=
|
||||||
#define TOK_EMPTY 57
|
#define TOK_UNDEFINED 57 // undefined
|
||||||
|
#define TOK_EMPTY 58
|
||||||
|
|
||||||
|
|
||||||
/* Represents the contents of a token. */
|
/* Represents the contents of a token. */
|
||||||
|
|||||||
@@ -1221,6 +1221,12 @@ parse_primary_expression (void)
|
|||||||
STACK_PUSH (IDX, token_data ());
|
STACK_PUSH (IDX, token_data ());
|
||||||
break;
|
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_NULL:
|
||||||
case TOK_BOOL:
|
case TOK_BOOL:
|
||||||
case TOK_SMALL_INT:
|
case TOK_SMALL_INT:
|
||||||
|
|||||||
Reference in New Issue
Block a user