Commit a0467ef1 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

jscript: Make undefined a property of global object.

parent 68453a52
......@@ -350,9 +350,6 @@ static HRESULT equal2_values(VARIANT *lval, VARIANT *rval, BOOL *ret)
static HRESULT literal_to_var(script_ctx_t *ctx, literal_t *literal, VARIANT *v)
{
switch(literal->type) {
case LT_UNDEFINED:
V_VT(v) = VT_EMPTY;
break;
case LT_NULL:
V_VT(v) = VT_NULL;
break;
......
......@@ -131,7 +131,6 @@ typedef enum {
LT_DOUBLE,
LT_STRING,
LT_BOOL,
LT_UNDEFINED,
LT_NULL,
LT_REGEXP
}literal_type_t;
......
......@@ -1176,6 +1176,11 @@ HRESULT init_global(script_ctx_t *ctx)
if(FAILED(hres))
return hres;
V_VT(&var) = VT_EMPTY;
hres = jsdisp_propput_name(ctx->global, undefinedW, &var, NULL/*FIXME*/, NULL/*FIXME*/);
if(FAILED(hres))
return hres;
V_VT(&var) = VT_DISPATCH;
V_DISPATCH(&var) = (IDispatch*)_IDispatchEx_(math);
hres = jsdisp_propput_name(ctx->global, MathW, &var, NULL/*FIXME*/, NULL/*FIXME*/);
......
......@@ -91,7 +91,6 @@ static const struct {
{trueW, kTRUE},
{tryW, kTRY},
{typeofW, kTYPEOF},
{undefinedW, kUNDEFINED},
{varW, kVAR},
{voidW, kVOID},
{whileW, kWHILE},
......
......@@ -38,7 +38,6 @@ typedef struct _statement_list_t {
static literal_t *new_string_literal(parser_ctx_t*,const WCHAR*);
static literal_t *new_null_literal(parser_ctx_t*);
static literal_t *new_undefined_literal(parser_ctx_t*);
static literal_t *new_boolean_literal(parser_ctx_t*,VARIANT_BOOL);
typedef struct _property_list_t {
......@@ -171,7 +170,7 @@ static source_elements_t *source_elements_add_statement(source_elements_t*,state
/* keywords */
%token kBREAK kCASE kCATCH kCONTINUE kDEFAULT kDELETE kDO kELSE kIF kFINALLY kFOR kIN
%token kINSTANCEOF kNEW kNULL kUNDEFINED kRETURN kSWITCH kTHIS kTHROW kTRUE kFALSE kTRY kTYPEOF kVAR kVOID kWHILE kWITH
%token kINSTANCEOF kNEW kNULL kRETURN kSWITCH kTHIS kTHROW kTRUE kFALSE kTRY kTYPEOF kVAR kVOID kWHILE kWITH
%token tANDAND tOROR tINC tDEC tHTMLCOMMENT kDIVEQ
%token <srcptr> kFUNCTION '}'
......@@ -800,7 +799,6 @@ Identifier_opt
/* ECMA-262 3rd Edition 7.8 */
Literal
: kNULL { $$ = new_null_literal(ctx); }
| kUNDEFINED { $$ = new_undefined_literal(ctx); }
| BooleanLiteral { $$ = $1; }
| tNumericLiteral { $$ = $1; }
| tStringLiteral { $$ = new_string_literal(ctx, $1); }
......@@ -856,15 +854,6 @@ static literal_t *new_null_literal(parser_ctx_t *ctx)
return ret;
}
static literal_t *new_undefined_literal(parser_ctx_t *ctx)
{
literal_t *ret = parser_alloc(ctx, sizeof(literal_t));
ret->type = LT_UNDEFINED;
return ret;
}
static literal_t *new_boolean_literal(parser_ctx_t *ctx, VARIANT_BOOL bval)
{
literal_t *ret = parser_alloc(ctx, sizeof(literal_t));
......
......@@ -1013,4 +1013,10 @@ ok(typeof(doesnotexist) === "undefined", "typeof(doesnotexist) = " + typeof(does
(function() { newValue = 1; })();
ok(newValue === 1, "newValue = " + newValue);
obj = {undefined: 3};
/* Keep this test in the end of file */
undefined = 6;
ok(undefined === 6, "undefined = " + undefined);
reportSuccess();
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment