jscript: Store source code range in function_code_t.
This commit is contained in:
parent
8c533d10d6
commit
375ab889d8
|
@ -1804,6 +1804,11 @@ static HRESULT compile_function(compiler_ctx_t *ctx, source_elements_t *source,
|
|||
return E_OUTOFMEMORY;
|
||||
}
|
||||
|
||||
if(func_expr) {
|
||||
func->source = func_expr->src_str;
|
||||
func->source_len = func_expr->src_len;
|
||||
}
|
||||
|
||||
func->source_elements = source;
|
||||
func->expr = func_expr;
|
||||
|
||||
|
|
|
@ -814,7 +814,7 @@ static HRESULT interp_func(exec_ctx_t *ctx)
|
|||
expr = ctx->func_code->funcs[func_idx].expr;
|
||||
|
||||
hres = create_source_function(ctx->script, ctx->code, expr->parameter_list, ctx->func_code->funcs+func_idx,
|
||||
ctx->scope_chain, expr->src_str, expr->src_len, &dispex);
|
||||
ctx->scope_chain, &dispex);
|
||||
if(FAILED(hres))
|
||||
return hres;
|
||||
|
||||
|
@ -2629,7 +2629,7 @@ HRESULT exec_source(exec_ctx_t *ctx, bytecode_t *code, function_code_t *func, BO
|
|||
|
||||
expr = func->funcs[i].expr;
|
||||
hres = create_source_function(ctx->script, code, expr->parameter_list, func->funcs+i,
|
||||
ctx->scope_chain, expr->src_str, expr->src_len, &func_obj);
|
||||
ctx->scope_chain, &func_obj);
|
||||
if(FAILED(hres))
|
||||
return hres;
|
||||
|
||||
|
|
|
@ -173,6 +173,9 @@ typedef struct _function_code_t {
|
|||
function_expression_t *expr; /* FIXME */
|
||||
source_elements_t *source_elements; /* FIXME */
|
||||
|
||||
const WCHAR *source;
|
||||
unsigned source_len;
|
||||
|
||||
unsigned func_cnt;
|
||||
struct _function_code_t *funcs;
|
||||
} function_code_t;
|
||||
|
@ -268,7 +271,7 @@ HRESULT exec_source(exec_ctx_t*,bytecode_t*,function_code_t*,BOOL,jsexcept_t*,VA
|
|||
typedef struct _parameter_t parameter_t;
|
||||
|
||||
HRESULT create_source_function(script_ctx_t*,bytecode_t*,parameter_t*,function_code_t*,scope_chain_t*,
|
||||
const WCHAR*,DWORD,jsdisp_t**) DECLSPEC_HIDDEN;
|
||||
jsdisp_t**) DECLSPEC_HIDDEN;
|
||||
|
||||
typedef enum {
|
||||
LT_INT,
|
||||
|
|
|
@ -32,8 +32,6 @@ typedef struct {
|
|||
scope_chain_t *scope_chain;
|
||||
bytecode_t *code;
|
||||
function_code_t *func_code;
|
||||
const WCHAR *src_str;
|
||||
DWORD src_len;
|
||||
DWORD length;
|
||||
jsdisp_t *arguments;
|
||||
} FunctionInstance;
|
||||
|
@ -303,7 +301,7 @@ static HRESULT function_to_string(FunctionInstance *function, BSTR *ret)
|
|||
memcpy(str + sizeof(native_prefixW)/sizeof(WCHAR), function->name, name_len*sizeof(WCHAR));
|
||||
memcpy(str + sizeof(native_prefixW)/sizeof(WCHAR) + name_len, native_suffixW, sizeof(native_suffixW));
|
||||
}else {
|
||||
str = SysAllocStringLen(function->src_str, function->src_len);
|
||||
str = SysAllocStringLen(function->func_code->source, function->func_code->source_len);
|
||||
if(!str)
|
||||
return E_OUTOFMEMORY;
|
||||
}
|
||||
|
@ -661,7 +659,7 @@ HRESULT create_builtin_function(script_ctx_t *ctx, builtin_invoke_t value_proc,
|
|||
}
|
||||
|
||||
HRESULT create_source_function(script_ctx_t *ctx, bytecode_t *code, parameter_t *parameters, function_code_t *func_code,
|
||||
scope_chain_t *scope_chain, const WCHAR *src_str, DWORD src_len, jsdisp_t **ret)
|
||||
scope_chain_t *scope_chain, jsdisp_t **ret)
|
||||
{
|
||||
FunctionInstance *function;
|
||||
jsdisp_t *prototype;
|
||||
|
@ -698,9 +696,6 @@ HRESULT create_source_function(script_ctx_t *ctx, bytecode_t *code, parameter_t
|
|||
length++;
|
||||
function->length = length;
|
||||
|
||||
function->src_str = src_str;
|
||||
function->src_len = src_len;
|
||||
|
||||
*ret = &function->dispex;
|
||||
return S_OK;
|
||||
}
|
||||
|
@ -786,8 +781,7 @@ static HRESULT construct_function(script_ctx_t *ctx, DISPPARAMS *dp, jsexcept_t
|
|||
}
|
||||
expr = code->global_code.funcs[0].expr;
|
||||
|
||||
hres = create_source_function(ctx, code, expr->parameter_list, code->global_code.funcs, NULL, expr->src_str,
|
||||
expr->src_len, &function);
|
||||
hres = create_source_function(ctx, code, expr->parameter_list, code->global_code.funcs, NULL, &function);
|
||||
release_bytecode(code);
|
||||
if(FAILED(hres))
|
||||
return hres;
|
||||
|
|
|
@ -836,7 +836,7 @@ static HRESULT WINAPI JScriptParseProcedure_ParseProcedureText(IActiveScriptPars
|
|||
return hres;
|
||||
}
|
||||
|
||||
hres = create_source_function(This->ctx, code, NULL, &code->global_code, NULL, NULL, 0, &dispex);
|
||||
hres = create_source_function(This->ctx, code, NULL, &code->global_code, NULL, &dispex);
|
||||
release_bytecode(code);
|
||||
if(FAILED(hres))
|
||||
return hres;
|
||||
|
|
Loading…
Reference in New Issue