[JSCRIPT] Sync with Wine Staging 4.18. CORE-16441

This commit is contained in:
Amine Khaldi 2019-11-02 18:38:06 +01:00
parent da0cd273de
commit 3e2d6582b7
31 changed files with 1860 additions and 1411 deletions

View file

@ -37,7 +37,7 @@ typedef struct _statement_list_t {
statement_t *tail;
} statement_list_t;
static literal_t *new_string_literal(parser_ctx_t*,const WCHAR*);
static literal_t *new_string_literal(parser_ctx_t*,jsstr_t*);
static literal_t *new_null_literal(parser_ctx_t*);
typedef struct _property_list_t {
@ -141,13 +141,13 @@ static source_elements_t *source_elements_add_statement(source_elements_t*,state
%lex-param { parser_ctx_t *ctx }
%parse-param { parser_ctx_t *ctx }
%pure-parser
%define api.pure
%start Program
%union {
int ival;
const WCHAR *srcptr;
LPCWSTR wstr;
jsstr_t *str;
literal_t *literal;
struct _argument_list_t *argument_list;
case_clausule_t *case_clausule;
@ -177,7 +177,7 @@ static source_elements_t *source_elements_add_statement(source_elements_t*,state
%token <identifier> tIdentifier
%token <ival> tAssignOper tEqOper tShiftOper tRelOper
%token <literal> tNumericLiteral tBooleanLiteral
%token <wstr> tStringLiteral
%token <str> tStringLiteral
%token tEOF
%type <source_elements> SourceElements
@ -813,7 +813,7 @@ GetterSetterMethod
/* Ecma-262 3rd Edition 11.1.5 */
PropertyName
: IdentifierName { $$ = new_string_literal(ctx, $1); }
: IdentifierName { $$ = new_string_literal(ctx, compiler_alloc_string_len(ctx->compiler, $1, lstrlenW($1))); }
| tStringLiteral { $$ = new_string_literal(ctx, $1); }
| tNumericLiteral { $$ = $1; }
@ -921,12 +921,12 @@ static void *new_statement(parser_ctx_t *ctx, statement_type_t type, size_t size
return stat;
}
static literal_t *new_string_literal(parser_ctx_t *ctx, const WCHAR *str)
static literal_t *new_string_literal(parser_ctx_t *ctx, jsstr_t *str)
{
literal_t *ret = parser_alloc(ctx, sizeof(literal_t));
ret->type = LT_STRING;
ret->u.wstr = str;
ret->u.str = str;
return ret;
}
@ -1566,7 +1566,7 @@ void parser_release(parser_ctx_t *ctx)
heap_free(ctx);
}
HRESULT script_parse(script_ctx_t *ctx, const WCHAR *code, const WCHAR *delimiter, BOOL from_eval,
HRESULT script_parse(script_ctx_t *ctx, struct _compiler_ctx_t *compiler, const WCHAR *code, const WCHAR *delimiter, BOOL from_eval,
parser_ctx_t **ret)
{
parser_ctx_t *parser_ctx;
@ -1580,10 +1580,10 @@ HRESULT script_parse(script_ctx_t *ctx, const WCHAR *code, const WCHAR *delimite
return E_OUTOFMEMORY;
parser_ctx->hres = JS_E_SYNTAX;
parser_ctx->is_html = delimiter && !strcmpiW(delimiter, html_tagW);
parser_ctx->is_html = delimiter && !wcsicmp(delimiter, html_tagW);
parser_ctx->begin = parser_ctx->ptr = code;
parser_ctx->end = parser_ctx->begin + strlenW(parser_ctx->begin);
parser_ctx->end = parser_ctx->begin + lstrlenW(parser_ctx->begin);
script_addref(ctx);
parser_ctx->script = ctx;
@ -1591,7 +1591,10 @@ HRESULT script_parse(script_ctx_t *ctx, const WCHAR *code, const WCHAR *delimite
mark = heap_pool_mark(&ctx->tmp_heap);
heap_pool_init(&parser_ctx->heap);
parser_ctx->compiler = compiler;
parser_parse(parser_ctx);
parser_ctx->compiler = NULL;
heap_pool_clear(mark);
hres = parser_ctx->hres;
if(FAILED(hres)) {