Commit 5436fc90 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

vbscript: Store source cookie and starting line in vbscode_t.

parent 7a76856e
......@@ -1856,7 +1856,7 @@ void release_vbscode(vbscode_t *code)
heap_free(code);
}
static vbscode_t *alloc_vbscode(compile_ctx_t *ctx, const WCHAR *source)
static vbscode_t *alloc_vbscode(compile_ctx_t *ctx, const WCHAR *source, DWORD_PTR cookie, unsigned start_line)
{
vbscode_t *ret;
size_t len;
......@@ -1878,6 +1878,9 @@ static vbscode_t *alloc_vbscode(compile_ctx_t *ctx, const WCHAR *source)
memcpy(ret->source, source, len * sizeof(WCHAR));
ret->source[len] = 0;
ret->cookie = cookie;
ret->start_line = start_line;
ret->instrs = heap_alloc(32*sizeof(instr_t));
if(!ret->instrs) {
release_vbscode(ret);
......@@ -1904,7 +1907,8 @@ static void release_compiler(compile_ctx_t *ctx)
release_vbscode(ctx->code);
}
HRESULT compile_script(script_ctx_t *script, const WCHAR *src, const WCHAR *delimiter, DWORD flags, vbscode_t **ret)
HRESULT compile_script(script_ctx_t *script, const WCHAR *src, const WCHAR *delimiter, DWORD_PTR cookie,
unsigned start_line, DWORD flags, vbscode_t **ret)
{
function_decl_t *func_decl;
class_decl_t *class_decl;
......@@ -1913,7 +1917,7 @@ HRESULT compile_script(script_ctx_t *script, const WCHAR *src, const WCHAR *deli
vbscode_t *code;
HRESULT hres;
code = ctx.code = alloc_vbscode(&ctx, src);
code = ctx.code = alloc_vbscode(&ctx, src, cookie, start_line);
if(!ctx.code)
return E_OUTOFMEMORY;
......@@ -1978,13 +1982,14 @@ HRESULT compile_script(script_ctx_t *script, const WCHAR *src, const WCHAR *deli
return S_OK;
}
HRESULT compile_procedure(script_ctx_t *script, const WCHAR *src, const WCHAR *delimiter, DWORD flags, class_desc_t **ret)
HRESULT compile_procedure(script_ctx_t *script, const WCHAR *src, const WCHAR *delimiter, DWORD_PTR cookie,
unsigned start_line, DWORD flags, class_desc_t **ret)
{
class_desc_t *desc;
vbscode_t *code;
HRESULT hres;
hres = compile_script(script, src, delimiter, flags & ~SCRIPTTEXT_ISPERSISTENT, &code);
hres = compile_script(script, src, delimiter, cookie, start_line, flags & ~SCRIPTTEXT_ISPERSISTENT, &code);
if(FAILED(hres))
return hres;
......
......@@ -875,7 +875,7 @@ static HRESULT WINAPI VBScriptParse_ParseScriptText(IActiveScriptParse *iface,
}
}
hres = compile_script(This->ctx, pstrCode, pstrDelimiter, dwFlags, &code);
hres = compile_script(This->ctx, pstrCode, pstrDelimiter, dwSourceContextCookie, ulStartingLine, dwFlags, &code);
if(FAILED(hres))
return hres;
......@@ -939,7 +939,8 @@ static HRESULT WINAPI VBScriptParseProcedure_ParseProcedureText(IActiveScriptPar
if(This->thread_id != GetCurrentThreadId() || This->state == SCRIPTSTATE_CLOSED)
return E_UNEXPECTED;
hres = compile_procedure(This->ctx, pstrCode, pstrDelimiter, dwFlags, &desc);
hres = compile_procedure(This->ctx, pstrCode, pstrDelimiter, dwSourceContextCookie, ulStartingLineNumber,
dwFlags, &desc);
if(FAILED(hres))
return hres;
......
......@@ -335,9 +335,12 @@ struct _function_t {
struct _vbscode_t {
instr_t *instrs;
WCHAR *source;
unsigned ref;
WCHAR *source;
DWORD_PTR cookie;
unsigned start_line;
BOOL option_explicit;
BOOL pending_exec;
......@@ -363,8 +366,8 @@ static inline void grab_vbscode(vbscode_t *code)
}
void release_vbscode(vbscode_t*) DECLSPEC_HIDDEN;
HRESULT compile_script(script_ctx_t*,const WCHAR*,const WCHAR*,DWORD,vbscode_t**) DECLSPEC_HIDDEN;
HRESULT compile_procedure(script_ctx_t*,const WCHAR*,const WCHAR*,DWORD,class_desc_t**) DECLSPEC_HIDDEN;
HRESULT compile_script(script_ctx_t*,const WCHAR*,const WCHAR*,DWORD_PTR,unsigned,DWORD,vbscode_t**) DECLSPEC_HIDDEN;
HRESULT compile_procedure(script_ctx_t*,const WCHAR*,const WCHAR*,DWORD_PTR,unsigned,DWORD,class_desc_t**) DECLSPEC_HIDDEN;
HRESULT exec_script(script_ctx_t*,BOOL,function_t*,vbdisp_t*,DISPPARAMS*,VARIANT*) DECLSPEC_HIDDEN;
void release_dynamic_var(dynamic_var_t*) DECLSPEC_HIDDEN;
IDispatch *lookup_named_item(script_ctx_t*,const WCHAR*,unsigned) DECLSPEC_HIDDEN;
......
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