Parse undefined as simple

This commit is contained in:
Ilmir Usmanov 2014-10-01 14:30:04 +04:00
parent 6561c3fe6c
commit c8b97214fe
3 changed files with 16 additions and 1 deletions

View File

@ -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;
}

View File

@ -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. */

View File

@ -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: