vbscript: Added compiler/parser support for call expressions.
This commit is contained in:
parent
6d7ec9cf71
commit
114ffc8720
|
@ -146,7 +146,7 @@ static HRESULT compile_args(compile_ctx_t *ctx, expression_t *args, unsigned *re
|
|||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT compile_member_expression(compile_ctx_t *ctx, member_expression_t *expr)
|
||||
static HRESULT compile_member_expression(compile_ctx_t *ctx, member_expression_t *expr, BOOL ret_val)
|
||||
{
|
||||
unsigned arg_cnt = 0;
|
||||
HRESULT hres;
|
||||
|
@ -159,7 +159,7 @@ static HRESULT compile_member_expression(compile_ctx_t *ctx, member_expression_t
|
|||
FIXME("obj_expr not implemented\n");
|
||||
hres = E_NOTIMPL;
|
||||
}else {
|
||||
hres = push_instr_bstr_uint(ctx, OP_icallv, expr->identifier, arg_cnt);
|
||||
hres = push_instr_bstr_uint(ctx, ret_val ? OP_icall : OP_icallv, expr->identifier, arg_cnt);
|
||||
}
|
||||
|
||||
return hres;
|
||||
|
@ -198,6 +198,8 @@ static HRESULT compile_expression(compile_ctx_t *ctx, expression_t *expr)
|
|||
return push_instr_int(ctx, OP_bool, ((bool_expression_t*)expr)->value);
|
||||
case EXPR_EQUAL:
|
||||
return compile_binary_expression(ctx, (binary_expression_t*)expr, OP_equal);
|
||||
case EXPR_MEMBER:
|
||||
return compile_member_expression(ctx, (member_expression_t*)expr, TRUE);
|
||||
case EXPR_NOT:
|
||||
return compile_unary_expression(ctx, (unary_expression_t*)expr, OP_not);
|
||||
case EXPR_STRING:
|
||||
|
@ -217,7 +219,7 @@ static HRESULT compile_statement(compile_ctx_t *ctx, statement_t *stat)
|
|||
while(stat) {
|
||||
switch(stat->type) {
|
||||
case STAT_CALL:
|
||||
hres = compile_member_expression(ctx, ((call_statement_t*)stat)->expr);
|
||||
hres = compile_member_expression(ctx, ((call_statement_t*)stat)->expr, FALSE);
|
||||
break;
|
||||
default:
|
||||
FIXME("Unimplemented statement type %d\n", stat->type);
|
||||
|
|
|
@ -168,6 +168,12 @@ static void vbstack_to_dp(exec_ctx_t *ctx, unsigned arg_cnt, DISPPARAMS *dp)
|
|||
}
|
||||
}
|
||||
|
||||
static HRESULT interp_icall(exec_ctx_t *ctx)
|
||||
{
|
||||
FIXME("\n");
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT interp_icallv(exec_ctx_t *ctx)
|
||||
{
|
||||
BSTR identifier = ctx->instr->arg1.bstr;
|
||||
|
|
|
@ -75,7 +75,7 @@ static statement_t *new_call_statement(parser_ctx_t*,member_expression_t*);
|
|||
%token <string> tIdentifier tString
|
||||
|
||||
%type <statement> Statement StatementNl
|
||||
%type <expression> Expression LiteralExpression PrimaryExpression EqualityExpression
|
||||
%type <expression> Expression LiteralExpression PrimaryExpression EqualityExpression CallExpression
|
||||
%type <expression> ConcatExpression
|
||||
%type <expression> NotExpression
|
||||
%type <member> MemberExpression
|
||||
|
@ -135,7 +135,11 @@ EqualityExpression
|
|||
|
||||
ConcatExpression
|
||||
: LiteralExpression /* FIXME */ { $$ = $1; }
|
||||
| PrimaryExpression /* FIXME */ { $$ = $1; }
|
||||
| CallExpression /* FIXME */ { $$ = $1; }
|
||||
|
||||
CallExpression
|
||||
: PrimaryExpression { $$ = $1; }
|
||||
| MemberExpression Arguments_opt { $1->args = $2; $$ = &$1->expr; }
|
||||
|
||||
LiteralExpression
|
||||
: tTRUE { $$ = new_bool_expression(ctx, VARIANT_TRUE); CHECK_ERROR; }
|
||||
|
|
|
@ -77,6 +77,7 @@ typedef enum {
|
|||
#define OP_LIST \
|
||||
X(bool, 1, ARG_INT, 0) \
|
||||
X(equal, 1, 0, 0) \
|
||||
X(icall, 1, ARG_BSTR, ARG_UINT) \
|
||||
X(icallv, 1, ARG_BSTR, ARG_UINT) \
|
||||
X(not, 1, 0, 0) \
|
||||
X(ret, 0, 0, 0) \
|
||||
|
|
Loading…
Reference in New Issue