summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 2a0d7e7)
raw | patch | inline | side by side (parent: 2a0d7e7)
author | DeaDDooMER <deaddoomer@deadsoftware.ru> | |
Tue, 25 Jul 2017 18:18:15 +0000 (21:18 +0300) | ||
committer | DeaDDooMER <deaddoomer@deadsoftware.ru> | |
Tue, 25 Jul 2017 18:18:15 +0000 (21:18 +0300) |
src/backends/jvm/generator-jvm.c | patch | blob | history | |
src/test.c | patch | blob | history |
index 2a2abcdcd3632f1b73a22aecc2135138f8e94523..9812f0ab7f5e2b56c243c94c97e6a0fc8ca86037 100644 (file)
fprintf(fp, " aload_0\n");
fprintf(fp, " invokespecial java/lang/Object/<init>()V\n");
fprintf(fp, " return\n");
- fprintf(fp, ".end method\n");
+ fprintf(fp, ".end method\n\n");
fprintf(fp, ".method public abstract invoke%s\n", signature);
fprintf(fp, ".end method\n\n");
switch(var -> class)
{
+ case OBERON_CLASS_VAR_PARAM:
+ oberon_error(ctx, "generator: VAR-parameters not implemented");
+ break;
case OBERON_CLASS_PARAM:
case OBERON_CLASS_FIELD:
break;
// GENERATOR
// =======================================================================
+static void
+push_expr(oberon_context_t * ctx, FILE * fp, oberon_expr_t * expr);
+
void
oberon_generate_begin_module(oberon_context_t * ctx)
{
void
oberon_generate_call_proc(oberon_context_t * ctx, oberon_expr_t * desig)
{
- printf("call proc\n");
+ oberon_object_t * proc;
+ gen_module_t * m;
+ char * fullname;
+ char * signature;
+
+ assert(desig -> is_item);
+ assert(desig -> item.mode == MODE_CALL);
+
+ m = ctx -> mod -> gen_mod;
+ proc = desig -> item.var;
+ fullname = get_field_full_name(ctx, proc);
+ signature = get_procedure_signature(ctx, proc -> type);
+
+ int num = desig -> item.num_args;
+ oberon_expr_t * arg = desig -> item.args;
+ for(int i = 0; i < num; i++)
+ {
+ push_expr(ctx, m -> fp, arg);
+ arg = arg -> next;
+ }
+
+ fprintf(m -> fp, "invokestatic %s%s\n", fullname, signature);
}
void
diff --git a/src/test.c b/src/test.c
index 53be5869213c0d3ee4a5e3e7fcd30639cf82ea59..0c80e4b7284e5cf5227ab29dfcbac7d87bb81631 100644 (file)
--- a/src/test.c
+++ b/src/test.c
" x : INTEGER;"
" z : BOOLEAN;"
""
- "PROCEDURE Tier(a, b :INTEGER);"
+ "PROCEDURE Tier(x : INTEGER);"
"END Tier;"
""
"BEGIN;"
- " x := x + 1;"
- " z := TRUE;"
+ " x := x + 1;"
+ " z := TRUE;"
+ " Tier(666);"
"END Test."
;