From 83c53d855a10474949c64767fe993249e9dc6a73 Mon Sep 17 00:00:00 2001
From: Jacek Caban <jacek@codeweavers.com>
Date: Thu, 24 Nov 2011 14:23:26 +0100
Subject: [PATCH] jscript: Use bytecode for null literal.

---
 dlls/jscript/compile.c |  2 ++
 dlls/jscript/engine.c  | 11 +++++++++++
 dlls/jscript/engine.h  |  1 +
 3 files changed, 14 insertions(+)

diff --git a/dlls/jscript/compile.c b/dlls/jscript/compile.c
index 85d38da3f71..0f4381ad276 100644
--- a/dlls/jscript/compile.c
+++ b/dlls/jscript/compile.c
@@ -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);
     case LT_INT:
         return push_instr_int(ctx, OP_int, literal->u.lval);
+    case LT_NULL:
+        return push_instr(ctx, OP_null);
     case LT_STRING:
         return push_instr_str(ctx, OP_str, literal->u.wstr);
     default:
diff --git a/dlls/jscript/engine.c b/dlls/jscript/engine.c
index e9dc97616f6..66d10d677c6 100644
--- a/dlls/jscript/engine.c
+++ b/dlls/jscript/engine.c
@@ -1724,6 +1724,17 @@ HRESULT identifier_expression_eval(script_ctx_t *ctx, expression_t *_expr, DWORD
     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 */
 HRESULT interp_bool(exec_ctx_t *ctx)
 {
diff --git a/dlls/jscript/engine.h b/dlls/jscript/engine.h
index 2c099e4c598..b48f04c0e9e 100644
--- a/dlls/jscript/engine.h
+++ b/dlls/jscript/engine.h
@@ -51,6 +51,7 @@ typedef struct _func_stack {
     X(int, 1, ARG_INT)                            \
     X(neg, 1, 0)                                  \
     X(neq2, 1, 0)                                 \
+    X(null, 1, 0)                                 \
     X(str, 1, 0)                                  \
     X(tonum, 1, 0)                                \
     X(tree, 1, ARG_EXPR)                          \
-- 
GitLab