vbscript: Added interpreter support for numeric literals.
authorJacek Caban <jacek@codeweavers.com>
Mon, 12 Sep 2011 10:30:21 +0000 (12:30 +0200)
committerAlexandre Julliard <julliard@winehq.org>
Mon, 12 Sep 2011 14:49:42 +0000 (16:49 +0200)
dlls/vbscript/interp.c
dlls/vbscript/tests/lang.vbs

index e7e3ab3f5c2e4948b5303a008ad1e7c31ebf506d..16617001c1f83b6fdff0c3a5185d8b04a320ef11 100644 (file)
@@ -253,20 +253,38 @@ static HRESULT interp_string(exec_ctx_t *ctx)
 
 static HRESULT interp_long(exec_ctx_t *ctx)
 {
-    FIXME("\n");
-    return E_NOTIMPL;
+    const LONG arg = ctx->instr->arg1.lng;
+    VARIANT v;
+
+    TRACE("%d\n", arg);
+
+    V_VT(&v) = VT_I4;
+    V_I4(&v) = arg;
+    return stack_push(ctx, &v);
 }
 
 static HRESULT interp_short(exec_ctx_t *ctx)
 {
-    FIXME("\n");
-    return E_NOTIMPL;
+    const LONG arg = ctx->instr->arg1.lng;
+    VARIANT v;
+
+    TRACE("%d\n", arg);
+
+    V_VT(&v) = VT_I2;
+    V_I2(&v) = arg;
+    return stack_push(ctx, &v);
 }
 
 static HRESULT interp_double(exec_ctx_t *ctx)
 {
-    FIXME("\n");
-    return E_NOTIMPL;
+    const DOUBLE *arg = ctx->instr->arg1.dbl;
+    VARIANT v;
+
+    TRACE("%lf\n", *arg);
+
+    V_VT(&v) = VT_R8;
+    V_R8(&v) = *arg;
+    return stack_push(ctx, &v);
 }
 
 static HRESULT interp_empty(exec_ctx_t *ctx)
index 8a5a9c52dbfc24916bbcc42e77843f8d9ebf804d..91da4fe9593f260e00924e8042542422def66373 100644 (file)
@@ -38,5 +38,11 @@ Call ok(getVT("") = "VT_BSTR", "getVT("""") is not VT_BSTR")
 Call ok(getVT("test") = "VT_BSTR", "getVT(""test"") is not VT_BSTR")
 Call ok(getVT(Empty) = "VT_EMPTY", "getVT(Empty) is not VT_EMPTY")
 Call ok(getVT(null) = "VT_NULL", "getVT(null) is not VT_NULL")
+Call ok(getVT(0) = "VT_I2", "getVT(0) is not VT_I2")
+Call ok(getVT(1) = "VT_I2", "getVT(1) is not VT_I2")
+Call ok(getVT(0.5) = "VT_R8", "getVT(0.5) is not VT_R8")
+Call ok(getVT(0.0) = "VT_R8", "getVT(0.0) is not VT_R8")
+Call ok(getVT(2147483647) = "VT_I4", "getVT(2147483647) is not VT_I4")
+Call ok(getVT(2147483648) = "VT_R8", "getVT(2147483648) is not VT_R8")
 
 reportSuccess()