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