Module: wine Branch: master Commit: 8b3638879795465395a27dc9ccfcfdf39acab3d1 URL: http://source.winehq.org/git/wine.git/?a=commit;h=8b3638879795465395a27dc9cc...
Author: Jacek Caban jacek@codeweavers.com Date: Wed Oct 1 10:45:30 2014 +0200
jscript: Implicitly turn CC on for @set instruction.
---
dlls/jscript/lex.c | 20 +++++++++++++------- dlls/jscript/tests/run.c | 2 ++ 2 files changed, 15 insertions(+), 7 deletions(-)
diff --git a/dlls/jscript/lex.c b/dlls/jscript/lex.c index 3daaf47..e541182 100644 --- a/dlls/jscript/lex.c +++ b/dlls/jscript/lex.c @@ -852,7 +852,7 @@ static cc_var_t *find_cc_var(cc_ctx_t *cc, const WCHAR *name, unsigned name_len) return NULL; }
-static int init_cc(parser_ctx_t *ctx) +static BOOL init_cc(parser_ctx_t *ctx) { cc_ctx_t *cc;
@@ -865,11 +865,13 @@ static int init_cc(parser_ctx_t *ctx) static const WCHAR _jscript_versionW[] = {'_','j','s','c','r','i','p','t','_','v','e','r','s','i','o','n',0};
if(ctx->script->cc) - return 0; + return TRUE;
cc = heap_alloc(sizeof(cc_ctx_t)); - if(!cc) - return lex_error(ctx, E_OUTOFMEMORY); + if(!cc) { + lex_error(ctx, E_OUTOFMEMORY); + return FALSE; + }
cc->vars = NULL;
@@ -879,11 +881,12 @@ static int init_cc(parser_ctx_t *ctx) || !new_cc_var(cc, _jscript_versionW, -1, ccval_num(JSCRIPT_MAJOR_VERSION + (DOUBLE)JSCRIPT_MINOR_VERSION/10.0)) || !new_cc_var(cc, _jscript_buildW, -1, ccval_num(JSCRIPT_BUILD_VERSION))) { release_cc(cc); - return lex_error(ctx, E_OUTOFMEMORY); + lex_error(ctx, E_OUTOFMEMORY); + return FALSE; }
ctx->script->cc = cc; - return 0; + return TRUE; }
static BOOL parse_cc_identifier(parser_ctx_t *ctx, const WCHAR **ret, unsigned *ret_len) @@ -1011,13 +1014,16 @@ static int cc_token(parser_ctx_t *ctx, void *lval) ctx->ptr++;
if(!check_keyword(ctx, cc_onW, NULL)) - return init_cc(ctx); + return init_cc(ctx) ? 0 : -1;
if(!check_keyword(ctx, setW, NULL)) { const WCHAR *ident; unsigned ident_len; cc_var_t *var;
+ if(!init_cc(ctx)) + return -1; + if(!skip_spaces(ctx)) return lex_error(ctx, JS_E_EXPECTED_AT);
diff --git a/dlls/jscript/tests/run.c b/dlls/jscript/tests/run.c index b8edd7d..42336a4 100644 --- a/dlls/jscript/tests/run.c +++ b/dlls/jscript/tests/run.c @@ -2183,6 +2183,8 @@ static BOOL run_tests(void) CHECK_CALLED(testobj_withprop_d); CHECK_CALLED(testobj_withprop_i);
+ parse_script_a("@set @t=2\nok(@t === 2, '@t = ' + @t);"); + run_from_res("lang.js"); run_from_res("api.js"); run_from_res("regexp.js");