Commit 54740a5c authored by Robert Wilhelm's avatar Robert Wilhelm Committed by Alexandre Julliard

vbscript: Add is_default flag to function_decl_t.

parent a66bb831
......@@ -1468,7 +1468,6 @@ static HRESULT compile_func(compile_ctx_t *ctx, statement_t *stat, function_t *f
case FUNC_PROPGET:
case FUNC_PROPLET:
case FUNC_PROPSET:
case FUNC_DEFGET:
ctx->prop_end_label = alloc_label(ctx);
if(!ctx->prop_end_label)
return E_OUTOFMEMORY;
......@@ -1630,7 +1629,6 @@ static HRESULT create_class_funcprop(compile_ctx_t *ctx, function_decl_t *func_d
case FUNC_FUNCTION:
case FUNC_SUB:
case FUNC_PROPGET:
case FUNC_DEFGET:
invoke_type = VBDISP_CALLGET;
break;
case FUNC_PROPLET:
......@@ -1696,7 +1694,7 @@ static HRESULT compile_class(compile_ctx_t *ctx, class_decl_t *class_decl)
for(func_decl = class_decl->funcs; func_decl; func_decl = func_decl->next) {
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)
if(func_prop_decl->is_default)
break;
}
if(!func_prop_decl)
......@@ -1710,7 +1708,7 @@ static HRESULT compile_class(compile_ctx_t *ctx, class_decl_t *class_decl)
for(func_decl = class_decl->funcs, i=1; func_decl; func_decl = func_decl->next, 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) {
if(func_prop_decl->is_default) {
i--;
break;
}
......
......@@ -134,7 +134,7 @@ static HRESULT lookup_identifier(exec_ctx_t *ctx, BSTR name, vbdisp_invoke_type_
DISPID id;
HRESULT hres;
if((ctx->func->type == FUNC_FUNCTION || ctx->func->type == FUNC_PROPGET || ctx->func->type == FUNC_DEFGET)
if((ctx->func->type == FUNC_FUNCTION || ctx->func->type == FUNC_PROPGET)
&& !wcsicmp(name, ctx->func->name)) {
ref->type = REF_VAR;
ref->u.v = &ctx->ret_val;
......
......@@ -184,6 +184,7 @@ typedef struct _function_decl_t {
const WCHAR *name;
function_type_t type;
BOOL is_public;
BOOL is_default;
arg_decl_t *args;
statement_t *body;
struct _function_decl_t *next;
......
......@@ -990,10 +990,11 @@ static function_decl_t *new_function_decl(parser_ctx_t *ctx, const WCHAR *name,
unsigned storage_flags, arg_decl_t *arg_decl, statement_t *body)
{
function_decl_t *decl;
BOOL is_default = FALSE;
if(storage_flags & STORAGE_IS_DEFAULT) {
if(type == FUNC_PROPGET) {
type = FUNC_DEFGET;
is_default = TRUE;
}else {
FIXME("Invalid default property\n");
ctx->hres = E_FAIL;
......@@ -1008,6 +1009,7 @@ static function_decl_t *new_function_decl(parser_ctx_t *ctx, const WCHAR *name,
decl->name = name;
decl->type = type;
decl->is_public = !(storage_flags & STORAGE_IS_PRIVATE);
decl->is_default = is_default;
decl->args = arg_decl;
decl->body = body;
decl->next = NULL;
......
......@@ -177,7 +177,7 @@ static HRESULT invoke_vbdisp(vbdisp_t *This, DISPID id, DWORD flags, BOOL extern
switch(flags) {
case DISPATCH_PROPERTYGET:
func = This->desc->funcs[id].entries[VBDISP_CALLGET];
if(!func || (func->type != FUNC_PROPGET && func->type != FUNC_DEFGET)) {
if(!func || func->type != FUNC_PROPGET) {
WARN("no getter\n");
return DISP_E_MEMBERNOTFOUND;
}
......
......@@ -314,7 +314,6 @@ typedef enum {
FUNC_PROPGET,
FUNC_PROPLET,
FUNC_PROPSET,
FUNC_DEFGET
} function_type_t;
typedef struct {
......
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