vbscript: Renamed vbscode_t's variables to not suggest that they are global code-only.

This commit is contained in:
Jacek Caban 2012-09-06 11:57:15 +02:00 committed by Alexandre Julliard
parent 080169f1d2
commit 9e3f75cfb1
3 changed files with 21 additions and 16 deletions

View File

@ -973,7 +973,7 @@ static HRESULT compile_const_statement(compile_ctx_t *ctx, const_statement_t *st
static HRESULT compile_function_statement(compile_ctx_t *ctx, function_statement_t *stat) static HRESULT compile_function_statement(compile_ctx_t *ctx, function_statement_t *stat)
{ {
if(ctx->func != &ctx->code->global_code) { if(ctx->func != &ctx->code->main_code) {
FIXME("Function is not in the global code\n"); FIXME("Function is not in the global code\n");
return E_FAIL; return E_FAIL;
} }
@ -1615,15 +1615,15 @@ static vbscode_t *alloc_vbscode(compile_ctx_t *ctx, const WCHAR *source)
ret->bstr_pool = NULL; ret->bstr_pool = NULL;
ret->bstr_pool_size = 0; ret->bstr_pool_size = 0;
ret->bstr_cnt = 0; ret->bstr_cnt = 0;
ret->global_executed = FALSE; ret->pending_exec = FALSE;
ret->global_code.type = FUNC_GLOBAL; ret->main_code.type = FUNC_GLOBAL;
ret->global_code.name = NULL; ret->main_code.name = NULL;
ret->global_code.code_ctx = ret; ret->main_code.code_ctx = ret;
ret->global_code.vars = NULL; ret->main_code.vars = NULL;
ret->global_code.var_cnt = 0; ret->main_code.var_cnt = 0;
ret->global_code.arg_cnt = 0; ret->main_code.arg_cnt = 0;
ret->global_code.args = NULL; ret->main_code.args = NULL;
list_init(&ret->entry); list_init(&ret->entry);
return ret; return ret;
@ -1664,7 +1664,7 @@ HRESULT compile_script(script_ctx_t *script, const WCHAR *src, vbscode_t **ret)
ctx.stat_ctx = NULL; ctx.stat_ctx = NULL;
ctx.labels_cnt = ctx.labels_size = 0; ctx.labels_cnt = ctx.labels_size = 0;
hres = compile_func(&ctx, ctx.parser.stats, &ctx.code->global_code); hres = compile_func(&ctx, ctx.parser.stats, &ctx.code->main_code);
if(FAILED(hres)) { if(FAILED(hres)) {
release_compiler(&ctx); release_compiler(&ctx);
return hres; return hres;

View File

@ -77,10 +77,10 @@ static HRESULT exec_global_code(script_ctx_t *ctx, vbscode_t *code)
{ {
HRESULT hres; HRESULT hres;
code->global_executed = TRUE; code->pending_exec = FALSE;
IActiveScriptSite_OnEnterScript(ctx->site); IActiveScriptSite_OnEnterScript(ctx->site);
hres = exec_script(ctx, &code->global_code, NULL, NULL, NULL); hres = exec_script(ctx, &code->main_code, NULL, NULL, NULL);
IActiveScriptSite_OnLeaveScript(ctx->site); IActiveScriptSite_OnLeaveScript(ctx->site);
return hres; return hres;
@ -91,7 +91,7 @@ static void exec_queued_code(script_ctx_t *ctx)
vbscode_t *iter; vbscode_t *iter;
LIST_FOR_EACH_ENTRY(iter, &ctx->code_list, vbscode_t, entry) { LIST_FOR_EACH_ENTRY(iter, &ctx->code_list, vbscode_t, entry) {
if(!iter->global_executed) if(iter->pending_exec)
exec_global_code(ctx, iter); exec_global_code(ctx, iter);
} }
} }
@ -604,7 +604,12 @@ static HRESULT WINAPI VBScriptParse_ParseScriptText(IActiveScriptParse *iface,
if(FAILED(hres)) if(FAILED(hres))
return hres; return hres;
return is_started(This) ? exec_global_code(This->ctx, code) : S_OK; if(!is_started(This)) {
code->pending_exec = TRUE;
return S_OK;
}
return exec_global_code(This->ctx, code);
} }
static const IActiveScriptParseVtbl VBScriptParseVtbl = { static const IActiveScriptParseVtbl VBScriptParseVtbl = {

View File

@ -298,8 +298,8 @@ struct _vbscode_t {
BOOL option_explicit; BOOL option_explicit;
BOOL global_executed; BOOL pending_exec;
function_t global_code; function_t main_code;
BSTR *bstr_pool; BSTR *bstr_pool;
unsigned bstr_pool_size; unsigned bstr_pool_size;