jscript: Store a copy of code in parser_ctx_t.
This commit is contained in:
parent
911e923fbc
commit
d7edf0162d
|
@ -43,9 +43,9 @@ typedef struct _func_stack {
|
||||||
typedef struct _parser_ctx_t {
|
typedef struct _parser_ctx_t {
|
||||||
LONG ref;
|
LONG ref;
|
||||||
|
|
||||||
const WCHAR *ptr;
|
WCHAR *begin;
|
||||||
const WCHAR *begin;
|
|
||||||
const WCHAR *end;
|
const WCHAR *end;
|
||||||
|
const WCHAR *ptr;
|
||||||
|
|
||||||
script_ctx_t *script;
|
script_ctx_t *script;
|
||||||
source_elements_t *source;
|
source_elements_t *source;
|
||||||
|
|
|
@ -1594,6 +1594,7 @@ void parser_release(parser_ctx_t *ctx)
|
||||||
if(--ctx->ref)
|
if(--ctx->ref)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
heap_free(ctx->begin);
|
||||||
jsheap_free(&ctx->heap);
|
jsheap_free(&ctx->heap);
|
||||||
heap_free(ctx);
|
heap_free(ctx);
|
||||||
}
|
}
|
||||||
|
@ -1615,8 +1616,14 @@ HRESULT script_parse(script_ctx_t *ctx, const WCHAR *code, const WCHAR *delimite
|
||||||
parser_ctx->hres = JSCRIPT_ERROR|IDS_SYNTAX_ERROR;
|
parser_ctx->hres = JSCRIPT_ERROR|IDS_SYNTAX_ERROR;
|
||||||
parser_ctx->is_html = delimiter && !strcmpiW(delimiter, html_tagW);
|
parser_ctx->is_html = delimiter && !strcmpiW(delimiter, html_tagW);
|
||||||
|
|
||||||
parser_ctx->begin = parser_ctx->ptr = code;
|
parser_ctx->begin = heap_strdupW(code);
|
||||||
parser_ctx->end = code + strlenW(code);
|
if(!parser_ctx->begin) {
|
||||||
|
heap_free(parser_ctx);
|
||||||
|
return E_OUTOFMEMORY;
|
||||||
|
}
|
||||||
|
|
||||||
|
parser_ctx->ptr = parser_ctx->begin;
|
||||||
|
parser_ctx->end = parser_ctx->begin + strlenW(parser_ctx->begin);
|
||||||
|
|
||||||
script_addref(ctx);
|
script_addref(ctx);
|
||||||
parser_ctx->script = ctx;
|
parser_ctx->script = ctx;
|
||||||
|
|
Loading…
Reference in New Issue