mirror of
git://source.winehq.org/git/wine.git
synced 2024-10-05 00:24:07 +00:00
vbscript: Added support for default getters.
This commit is contained in:
parent
a03ad6b2cd
commit
a8de7904f5
|
@ -684,6 +684,7 @@ static HRESULT compile_func(compile_ctx_t *ctx, statement_t *stat, function_t *f
|
||||||
case FUNC_PROPGET:
|
case FUNC_PROPGET:
|
||||||
case FUNC_PROPLET:
|
case FUNC_PROPLET:
|
||||||
case FUNC_PROPSET:
|
case FUNC_PROPSET:
|
||||||
|
case FUNC_DEFGET:
|
||||||
ctx->prop_end_label = alloc_label(ctx);
|
ctx->prop_end_label = alloc_label(ctx);
|
||||||
if(ctx->prop_end_label == -1)
|
if(ctx->prop_end_label == -1)
|
||||||
return E_OUTOFMEMORY;
|
return E_OUTOFMEMORY;
|
||||||
|
@ -846,6 +847,7 @@ static HRESULT create_class_funcprop(compile_ctx_t *ctx, function_decl_t *func_d
|
||||||
case FUNC_FUNCTION:
|
case FUNC_FUNCTION:
|
||||||
case FUNC_SUB:
|
case FUNC_SUB:
|
||||||
case FUNC_PROPGET:
|
case FUNC_PROPGET:
|
||||||
|
case FUNC_DEFGET:
|
||||||
invoke_type = VBDISP_CALLGET;
|
invoke_type = VBDISP_CALLGET;
|
||||||
break;
|
break;
|
||||||
case FUNC_PROPLET:
|
case FUNC_PROPLET:
|
||||||
|
@ -885,7 +887,7 @@ static BOOL lookup_class_funcs(class_desc_t *class_desc, const WCHAR *name)
|
||||||
|
|
||||||
static HRESULT compile_class(compile_ctx_t *ctx, class_decl_t *class_decl)
|
static HRESULT compile_class(compile_ctx_t *ctx, class_decl_t *class_decl)
|
||||||
{
|
{
|
||||||
function_decl_t *func_decl;
|
function_decl_t *func_decl, *func_prop_decl;
|
||||||
class_prop_decl_t *prop_decl;
|
class_prop_decl_t *prop_decl;
|
||||||
class_desc_t *class_desc;
|
class_desc_t *class_desc;
|
||||||
unsigned i;
|
unsigned i;
|
||||||
|
@ -908,8 +910,14 @@ static HRESULT compile_class(compile_ctx_t *ctx, class_decl_t *class_decl)
|
||||||
class_desc->func_cnt = 1; /* always allocate slot for default getter */
|
class_desc->func_cnt = 1; /* always allocate slot for default getter */
|
||||||
class_desc->prop_cnt = 0;
|
class_desc->prop_cnt = 0;
|
||||||
|
|
||||||
for(func_decl = class_decl->funcs; func_decl; func_decl = func_decl->next)
|
for(func_decl = class_decl->funcs; func_decl; func_decl = func_decl->next) {
|
||||||
class_desc->func_cnt++;
|
for(func_prop_decl = func_decl; func_prop_decl; func_prop_decl = func_prop_decl->next_prop_func) {
|
||||||
|
if(func_prop_decl->type == FUNC_DEFGET)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if(!func_prop_decl)
|
||||||
|
class_desc->func_cnt++;
|
||||||
|
}
|
||||||
|
|
||||||
class_desc->funcs = compiler_alloc(ctx->code, class_desc->func_cnt*sizeof(*class_desc->funcs));
|
class_desc->funcs = compiler_alloc(ctx->code, class_desc->func_cnt*sizeof(*class_desc->funcs));
|
||||||
if(!class_desc->funcs)
|
if(!class_desc->funcs)
|
||||||
|
@ -917,7 +925,14 @@ static HRESULT compile_class(compile_ctx_t *ctx, class_decl_t *class_decl)
|
||||||
memset(class_desc->funcs, 0, class_desc->func_cnt*sizeof(*class_desc->funcs));
|
memset(class_desc->funcs, 0, class_desc->func_cnt*sizeof(*class_desc->funcs));
|
||||||
|
|
||||||
for(func_decl = class_decl->funcs, i=1; func_decl; func_decl = func_decl->next, i++) {
|
for(func_decl = class_decl->funcs, i=1; func_decl; func_decl = func_decl->next, i++) {
|
||||||
hres = create_class_funcprop(ctx, func_decl, class_desc->funcs + i);
|
for(func_prop_decl = func_decl; func_prop_decl; func_prop_decl = func_prop_decl->next_prop_func) {
|
||||||
|
if(func_prop_decl->type == FUNC_DEFGET) {
|
||||||
|
i--;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
hres = create_class_funcprop(ctx, func_decl, class_desc->funcs + (func_prop_decl ? 0 : i));
|
||||||
if(FAILED(hres))
|
if(FAILED(hres))
|
||||||
return hres;
|
return hres;
|
||||||
}
|
}
|
||||||
|
|
|
@ -92,7 +92,8 @@ static HRESULT lookup_identifier(exec_ctx_t *ctx, BSTR name, vbdisp_invoke_type_
|
||||||
DISPID id;
|
DISPID id;
|
||||||
HRESULT hres;
|
HRESULT hres;
|
||||||
|
|
||||||
if(invoke_type == VBDISP_LET && (ctx->func->type == FUNC_FUNCTION || ctx->func->type == FUNC_PROPGET)
|
if(invoke_type == VBDISP_LET
|
||||||
|
&& (ctx->func->type == FUNC_FUNCTION || ctx->func->type == FUNC_PROPGET || ctx->func->type == FUNC_DEFGET)
|
||||||
&& !strcmpiW(name, ctx->func->name)) {
|
&& !strcmpiW(name, ctx->func->name)) {
|
||||||
ref->type = REF_VAR;
|
ref->type = REF_VAR;
|
||||||
ref->u.v = &ctx->ret_val;
|
ref->u.v = &ctx->ret_val;
|
||||||
|
@ -1237,7 +1238,7 @@ HRESULT exec_script(script_ctx_t *ctx, function_t *func, IDispatch *this_obj, DI
|
||||||
}
|
}
|
||||||
|
|
||||||
assert(!exec.top);
|
assert(!exec.top);
|
||||||
if(func->type != FUNC_FUNCTION && func->type != FUNC_PROPGET)
|
if(func->type != FUNC_FUNCTION && func->type != FUNC_PROPGET && func->type != FUNC_DEFGET)
|
||||||
assert(V_VT(&exec.ret_val) == VT_EMPTY);
|
assert(V_VT(&exec.ret_val) == VT_EMPTY);
|
||||||
|
|
||||||
if(SUCCEEDED(hres) && res) {
|
if(SUCCEEDED(hres) && res) {
|
||||||
|
|
|
@ -602,8 +602,7 @@ static function_decl_t *new_function_decl(parser_ctx_t *ctx, const WCHAR *name,
|
||||||
|
|
||||||
if(storage_flags & STORAGE_IS_DEFAULT) {
|
if(storage_flags & STORAGE_IS_DEFAULT) {
|
||||||
if(type == FUNC_PROPGET) {
|
if(type == FUNC_PROPGET) {
|
||||||
FIXME("default value not implemented\n");
|
type = FUNC_DEFGET;
|
||||||
ctx->hres = E_NOTIMPL;
|
|
||||||
}else {
|
}else {
|
||||||
FIXME("Invalid default property\n");
|
FIXME("Invalid default property\n");
|
||||||
ctx->hres = E_FAIL;
|
ctx->hres = E_FAIL;
|
||||||
|
|
|
@ -406,6 +406,14 @@ Class TestClass
|
||||||
Call ok(false, "exit property not returned?")
|
Call ok(false, "exit property not returned?")
|
||||||
End Property
|
End Property
|
||||||
|
|
||||||
|
Public Default Property Get DefValGet
|
||||||
|
DefValGet = privateProp
|
||||||
|
funcCalled = "GetDefVal"
|
||||||
|
End Property
|
||||||
|
|
||||||
|
Public Property Let DefValGet(x)
|
||||||
|
End Property
|
||||||
|
|
||||||
Public publicProp2
|
Public publicProp2
|
||||||
|
|
||||||
Public Sub publicSub
|
Public Sub publicSub
|
||||||
|
|
|
@ -214,7 +214,8 @@ typedef enum {
|
||||||
FUNC_SUB,
|
FUNC_SUB,
|
||||||
FUNC_PROPGET,
|
FUNC_PROPGET,
|
||||||
FUNC_PROPLET,
|
FUNC_PROPLET,
|
||||||
FUNC_PROPSET
|
FUNC_PROPSET,
|
||||||
|
FUNC_DEFGET
|
||||||
} function_type_t;
|
} function_type_t;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|
Loading…
Reference in a new issue