jscript: Use bytecode for null literal.

This commit is contained in:
Jacek Caban 2011-11-24 14:23:26 +01:00 committed by Alexandre Julliard
parent ea0ebbfeb2
commit 83c53d855a
3 changed files with 14 additions and 0 deletions

View File

@ -179,6 +179,8 @@ static HRESULT compile_literal(compiler_ctx_t *ctx, literal_expression_t *expr)
return push_instr_double(ctx, OP_double, literal->u.dval); return push_instr_double(ctx, OP_double, literal->u.dval);
case LT_INT: case LT_INT:
return push_instr_int(ctx, OP_int, literal->u.lval); return push_instr_int(ctx, OP_int, literal->u.lval);
case LT_NULL:
return push_instr(ctx, OP_null);
case LT_STRING: case LT_STRING:
return push_instr_str(ctx, OP_str, literal->u.wstr); return push_instr_str(ctx, OP_str, literal->u.wstr);
default: default:

View File

@ -1724,6 +1724,17 @@ HRESULT identifier_expression_eval(script_ctx_t *ctx, expression_t *_expr, DWORD
return hres; return hres;
} }
/* ECMA-262 3rd Edition 7.8.1 */
HRESULT interp_null(exec_ctx_t *ctx)
{
VARIANT v;
TRACE("\n");
V_VT(&v) = VT_NULL;
return stack_push(ctx, &v);
}
/* ECMA-262 3rd Edition 7.8.2 */ /* ECMA-262 3rd Edition 7.8.2 */
HRESULT interp_bool(exec_ctx_t *ctx) HRESULT interp_bool(exec_ctx_t *ctx)
{ {

View File

@ -51,6 +51,7 @@ typedef struct _func_stack {
X(int, 1, ARG_INT) \ X(int, 1, ARG_INT) \
X(neg, 1, 0) \ X(neg, 1, 0) \
X(neq2, 1, 0) \ X(neq2, 1, 0) \
X(null, 1, 0) \
X(str, 1, 0) \ X(str, 1, 0) \
X(tonum, 1, 0) \ X(tonum, 1, 0) \
X(tree, 1, ARG_EXPR) \ X(tree, 1, ARG_EXPR) \