summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 3b56d87)
raw | patch | inline | side by side (parent: 3b56d87)
author | DeaDDooMER <deaddoomer@deadsoftware.ru> | |
Tue, 25 Jul 2017 18:28:01 +0000 (21:28 +0300) | ||
committer | DeaDDooMER <deaddoomer@deadsoftware.ru> | |
Tue, 25 Jul 2017 18:28:01 +0000 (21:28 +0300) |
src/backends/jvm/generator-jvm.c | patch | blob | history | |
src/test.c | patch | blob | history |
index 9812f0ab7f5e2b56c243c94c97e6a0fc8ca86037..dc04ffe3423a03433323e677b23f82cd1e1513a0 100644 (file)
oberon_generate_return(oberon_context_t * ctx, oberon_expr_t * expr)
{
gen_module_t * m;
+ char prefix;
m = ctx -> mod -> gen_mod;
if(expr)
{
- oberon_error(ctx, "oberon_generate_return: TODO return expr");
+ push_expr(ctx, m -> fp, expr);
+ prefix = get_prefix(ctx, expr -> result);
+ fprintf(m -> fp, " %creturn\n", prefix);
}
else
{
}
}
-static void push_expr(oberon_context_t * ctx, FILE * fp, oberon_expr_t * expr);
-
static void
push_var(oberon_context_t * ctx, FILE * fp, oberon_object_t * var)
{
push_int(fp, item -> boolean);
break;
case MODE_CALL:
- oberon_error(ctx, "push_item: TODO call");
+ oberon_generate_call_proc(ctx, (oberon_expr_t *) item);
break;
case MODE_INDEX:
oberon_error(ctx, "push_item: TODO index");
diff --git a/src/test.c b/src/test.c
index 0c80e4b7284e5cf5227ab29dfcbac7d87bb81631..e042f242afaaf997b8244fff25c06bb5c068c181 100644 (file)
--- a/src/test.c
+++ b/src/test.c
"MODULE Test;"
"VAR"
" x : INTEGER;"
- " z : BOOLEAN;"
""
- "PROCEDURE Tier(x : INTEGER);"
+ "PROCEDURE Tier(x : INTEGER) : INTEGER;"
+ "BEGIN"
+ " RETURN x * x;"
"END Tier;"
""
"BEGIN;"
- " x := x + 1;"
- " z := TRUE;"
- " Tier(666);"
+ " x := Tier(666);"
"END Test."
;