[PATCH v2 1/2] vbscript: add is_default flag to struct _function_decl_t.
Robert Wilhelm
robert.wilhelm at gmx.net
Mon Oct 12 16:48:10 CDT 2020
Signed-off-by: Robert Wilhelm <robert.wilhelm at gmx.net>
---
v2: unchanged
---
dlls/vbscript/compile.c | 6 ++----
dlls/vbscript/interp.c | 2 +-
dlls/vbscript/parse.h | 1 +
dlls/vbscript/parser.y | 4 +++-
dlls/vbscript/vbdisp.c | 2 +-
dlls/vbscript/vbscript.h | 1 -
6 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/dlls/vbscript/compile.c b/dlls/vbscript/compile.c
index 2e991b0c0ae..e9f6361aee9 100644
--- a/dlls/vbscript/compile.c
+++ b/dlls/vbscript/compile.c
@@ -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;
}
diff --git a/dlls/vbscript/interp.c b/dlls/vbscript/interp.c
index d58e89b7dba..a3bca804128 100644
--- a/dlls/vbscript/interp.c
+++ b/dlls/vbscript/interp.c
@@ -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;
diff --git a/dlls/vbscript/parse.h b/dlls/vbscript/parse.h
index ab81bb3ae41..f5d8a616b9f 100644
--- a/dlls/vbscript/parse.h
+++ b/dlls/vbscript/parse.h
@@ -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;
diff --git a/dlls/vbscript/parser.y b/dlls/vbscript/parser.y
index cf94bdce464..7e6cc17efd6 100644
--- a/dlls/vbscript/parser.y
+++ b/dlls/vbscript/parser.y
@@ -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;
diff --git a/dlls/vbscript/vbdisp.c b/dlls/vbscript/vbdisp.c
index 36eba21e279..1ff1110e56b 100644
--- a/dlls/vbscript/vbdisp.c
+++ b/dlls/vbscript/vbdisp.c
@@ -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;
}
diff --git a/dlls/vbscript/vbscript.h b/dlls/vbscript/vbscript.h
index 869fb05b6ed..afcce5eb9b8 100644
--- a/dlls/vbscript/vbscript.h
+++ b/dlls/vbscript/vbscript.h
@@ -314,7 +314,6 @@ typedef enum {
FUNC_PROPGET,
FUNC_PROPLET,
FUNC_PROPSET,
- FUNC_DEFGET
} function_type_t;
typedef struct {
--
2.26.2
More information about the wine-devel
mailing list