vbscript: Allow any call expression to be used in set statement.

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Jacek Caban 2020-01-30 17:26:04 +01:00 committed by Alexandre Julliard
parent c994118401
commit d26998d6e5
2 changed files with 9 additions and 12 deletions

View file

@ -48,7 +48,7 @@ static call_expression_t *make_call_expression(parser_ctx_t*,expression_t*,expre
static void *new_statement(parser_ctx_t*,statement_type_t,size_t,unsigned);
static statement_t *new_call_statement(parser_ctx_t*,unsigned,BOOL,expression_t*);
static statement_t *new_assign_statement(parser_ctx_t*,unsigned,expression_t*,expression_t*);
static statement_t *new_set_statement(parser_ctx_t*,unsigned,member_expression_t*,expression_t*,expression_t*);
static statement_t *new_set_statement(parser_ctx_t*,unsigned,expression_t*,expression_t*);
static statement_t *new_dim_statement(parser_ctx_t*,unsigned,dim_decl_t*);
static statement_t *new_redim_statement(parser_ctx_t*,unsigned,const WCHAR*,BOOL,expression_t*);
static statement_t *new_while_statement(parser_ctx_t*,unsigned,statement_type_t,expression_t*,statement_t*);
@ -136,7 +136,7 @@ static statement_t *link_statements(statement_t*,statement_t*);
%type <expression> NotExpression UnaryExpression AndExpression OrExpression XorExpression EqvExpression SignExpression
%type <expression> ConstExpression NumericLiteralExpression
%type <member> MemberExpression
%type <expression> Arguments Arguments_opt ArgumentList ArgumentList_opt Step_opt ExpressionList
%type <expression> Arguments ArgumentList ArgumentList_opt Step_opt ExpressionList
%type <boolean> DoType Preserve_opt
%type <arg_decl> ArgumentsDecl_opt ArgumentDeclList ArgumentDecl
%type <func_decl> FunctionDecl PropertyDecl
@ -216,8 +216,7 @@ SimpleStatement
| tEXIT tFUNCTION { $$ = new_statement(ctx, STAT_EXITFUNC, 0, @$); CHECK_ERROR; }
| tEXIT tPROPERTY { $$ = new_statement(ctx, STAT_EXITPROP, 0, @$); CHECK_ERROR; }
| tEXIT tSUB { $$ = new_statement(ctx, STAT_EXITSUB, 0, @$); CHECK_ERROR; }
| tSET MemberExpression Arguments_opt '=' Expression
{ $$ = new_set_statement(ctx, @$, $2, $3, $5); CHECK_ERROR; }
| tSET CallExpression '=' Expression { $$ = new_set_statement(ctx, @$, $2, $4); CHECK_ERROR; }
| tSTOP { $$ = new_statement(ctx, STAT_STOP, 0, @$); CHECK_ERROR; }
| tON tERROR tRESUME tNEXT { $$ = new_onerror_statement(ctx, @$, TRUE); CHECK_ERROR; }
| tON tERROR tGOTO '0' { $$ = new_onerror_statement(ctx, @$, FALSE); CHECK_ERROR; }
@ -310,10 +309,6 @@ Arguments
: tEMPTYBRACKETS { $$ = NULL; }
| '(' ArgumentList ')' { $$ = $2; }
Arguments_opt
: /* empty */ { $$ = NULL; }
| Arguments { $$ = $1; }
ArgumentList_opt
: /* empty */ { $$ = NULL; }
| ArgumentList { $$ = $1; }
@ -769,7 +764,7 @@ static statement_t *new_assign_statement(parser_ctx_t *ctx, unsigned loc, expres
return &stat->stat;
}
static statement_t *new_set_statement(parser_ctx_t *ctx, unsigned loc, member_expression_t *left, expression_t *arguments, expression_t *right)
static statement_t *new_set_statement(parser_ctx_t *ctx, unsigned loc, expression_t *left, expression_t *right)
{
assign_statement_t *stat;
@ -777,10 +772,8 @@ static statement_t *new_set_statement(parser_ctx_t *ctx, unsigned loc, member_ex
if(!stat)
return NULL;
stat->left_expr = left;
stat->value_expr = right;
stat->left_expr = (expression_t*)new_call_expression(ctx, &left->expr, arguments);
if(!stat->left_expr)
return NULL;
return &stat->stat;
}

View file

@ -1630,6 +1630,10 @@ x.prop.prop.prop = 2
call ok(x.getProp().getProp.prop = 2, "x.getProp().getProp.prop = " & x.getProp().getProp.prop)
x.getprop.getprop().prop = 3
call ok(x.getProp.prop.prop = 3, "x.getProp.prop.prop = " & x.getProp.prop.prop)
set x.getprop.getprop().prop = new emptyclass
set obj = new emptyclass
set x.getprop.getprop().prop = obj
call ok(x.getprop.getprop().prop is obj, "x.getprop.getprop().prop is not obj (emptyclass)")
ok getVT(x) = "VT_DISPATCH*", "getVT(x) = " & getVT(x)
todo_wine_ok getVT(x()) = "VT_BSTR", "getVT(x()) = " & getVT(x())