Commit 6c8c617d authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

vbscript: Added support for exit property statement.

parent 097a75f6
...@@ -40,6 +40,7 @@ typedef struct { ...@@ -40,6 +40,7 @@ typedef struct {
unsigned sub_end_label; unsigned sub_end_label;
unsigned func_end_label; unsigned func_end_label;
unsigned prop_end_label;
dim_decl_t *dim_decls; dim_decl_t *dim_decls;
dynamic_var_t *global_vars; dynamic_var_t *global_vars;
...@@ -585,6 +586,16 @@ static HRESULT compile_exitfunc_statement(compile_ctx_t *ctx) ...@@ -585,6 +586,16 @@ static HRESULT compile_exitfunc_statement(compile_ctx_t *ctx)
return push_instr_addr(ctx, OP_jmp, ctx->func_end_label); return push_instr_addr(ctx, OP_jmp, ctx->func_end_label);
} }
static HRESULT compile_exitprop_statement(compile_ctx_t *ctx)
{
if(ctx->prop_end_label == -1) {
FIXME("Exit Property outside Property?\n");
return E_FAIL;
}
return push_instr_addr(ctx, OP_jmp, ctx->prop_end_label);
}
static HRESULT compile_statement(compile_ctx_t *ctx, statement_t *stat) static HRESULT compile_statement(compile_ctx_t *ctx, statement_t *stat)
{ {
HRESULT hres; HRESULT hres;
...@@ -603,6 +614,9 @@ static HRESULT compile_statement(compile_ctx_t *ctx, statement_t *stat) ...@@ -603,6 +614,9 @@ static HRESULT compile_statement(compile_ctx_t *ctx, statement_t *stat)
case STAT_EXITFUNC: case STAT_EXITFUNC:
hres = compile_exitfunc_statement(ctx); hres = compile_exitfunc_statement(ctx);
break; break;
case STAT_EXITPROP:
hres = compile_exitprop_statement(ctx);
break;
case STAT_EXITSUB: case STAT_EXITSUB:
hres = compile_exitsub_statement(ctx); hres = compile_exitsub_statement(ctx);
break; break;
...@@ -654,6 +668,7 @@ static HRESULT compile_func(compile_ctx_t *ctx, statement_t *stat, function_t *f ...@@ -654,6 +668,7 @@ static HRESULT compile_func(compile_ctx_t *ctx, statement_t *stat, function_t *f
ctx->sub_end_label = -1; ctx->sub_end_label = -1;
ctx->func_end_label = -1; ctx->func_end_label = -1;
ctx->prop_end_label = -1;
switch(func->type) { switch(func->type) {
case FUNC_FUNCTION: case FUNC_FUNCTION:
...@@ -669,7 +684,10 @@ static HRESULT compile_func(compile_ctx_t *ctx, statement_t *stat, function_t *f ...@@ -669,7 +684,10 @@ 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:
/* FIXME */ ctx->prop_end_label = alloc_label(ctx);
if(ctx->prop_end_label == -1)
return E_OUTOFMEMORY;
break;
case FUNC_GLOBAL: case FUNC_GLOBAL:
break; break;
} }
...@@ -685,6 +703,8 @@ static HRESULT compile_func(compile_ctx_t *ctx, statement_t *stat, function_t *f ...@@ -685,6 +703,8 @@ static HRESULT compile_func(compile_ctx_t *ctx, statement_t *stat, function_t *f
label_set_addr(ctx, ctx->sub_end_label); label_set_addr(ctx, ctx->sub_end_label);
if(ctx->func_end_label != -1) if(ctx->func_end_label != -1)
label_set_addr(ctx, ctx->func_end_label); label_set_addr(ctx, ctx->func_end_label);
if(ctx->prop_end_label != -1)
label_set_addr(ctx, ctx->prop_end_label);
if(push_instr(ctx, OP_ret) == -1) if(push_instr(ctx, OP_ret) == -1)
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
......
...@@ -94,6 +94,7 @@ typedef enum { ...@@ -94,6 +94,7 @@ typedef enum {
STAT_CALL, STAT_CALL,
STAT_DIM, STAT_DIM,
STAT_EXITFUNC, STAT_EXITFUNC,
STAT_EXITPROP,
STAT_EXITSUB, STAT_EXITSUB,
STAT_FUNC, STAT_FUNC,
STAT_IF, STAT_IF,
......
...@@ -155,6 +155,7 @@ Statement ...@@ -155,6 +155,7 @@ Statement
| IfStatement { $$ = $1; } | IfStatement { $$ = $1; }
| FunctionDecl { $$ = new_function_statement(ctx, $1); CHECK_ERROR; } | FunctionDecl { $$ = new_function_statement(ctx, $1); CHECK_ERROR; }
| tEXIT tFUNCTION { $$ = new_statement(ctx, STAT_EXITFUNC, 0); CHECK_ERROR; } | 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; } | tEXIT tSUB { $$ = new_statement(ctx, STAT_EXITSUB, 0); CHECK_ERROR; }
| tSET MemberExpression Arguments_opt '=' Expression | tSET MemberExpression Arguments_opt '=' Expression
{ $2->args = $3; $$ = new_set_statement(ctx, $2, $5); CHECK_ERROR; } { $2->args = $3; $$ = new_set_statement(ctx, $2, $5); CHECK_ERROR; }
......
...@@ -402,6 +402,8 @@ Class TestClass ...@@ -402,6 +402,8 @@ Class TestClass
Public Property Get gsProp() Public Property Get gsProp()
gsProp = privateProp gsProp = privateProp
funcCalled = "gsProp get" funcCalled = "gsProp get"
exit property
Call ok(false, "exit property not returned?")
End Property End Property
Public publicProp2 Public publicProp2
...@@ -412,10 +414,14 @@ Class TestClass ...@@ -412,10 +414,14 @@ Class TestClass
Public Property Let gsProp(val) Public Property Let gsProp(val)
privateProp = val privateProp = val
funcCalled = "gsProp let" funcCalled = "gsProp let"
exit property
Call ok(false, "exit property not returned?")
End Property End Property
Public Property Set gsProp(val) Public Property Set gsProp(val)
funcCalled = "gsProp set" funcCalled = "gsProp set"
exit property
Call ok(false, "exit property not returned?")
End Property End Property
Public Sub setPrivateProp(x) Public Sub setPrivateProp(x)
......
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