diff --git a/src/oberon.c b/src/oberon.c
index 382f4f182b2e98ca1032a7f720cc575e58ae9fc5..251a7df597c9887a7d2d319940bc99d70a812c35 100644 (file)
--- a/src/oberon.c
+++ b/src/oberon.c
// UTILS
// =======================================================================
-void
+static void
oberon_error(oberon_context_t * ctx, const char * fmt, ...)
{
va_list ptr;
if(scope -> up)
{
- scope -> parent = scope -> up -> parent;
scope -> local = scope -> up -> local;
+ scope -> parent = scope -> up -> parent;
+ scope -> parent_type = scope -> up -> parent_type;
}
ctx -> decl = scope;
@@ -168,6 +169,7 @@ oberon_define_object(oberon_scope_t * scope, char * name, int class, int export,
newvar -> read_only = read_only;
newvar -> local = scope -> local;
newvar -> parent = scope -> parent;
+ newvar -> parent_type = scope -> parent_type;
newvar -> module = scope -> ctx -> mod;
x -> next = newvar;
}
expr = oberon_term_expr(ctx);
+
+ if(minus)
+ {
+ expr = oberon_make_unary_op(ctx, MINUS, expr);
+ }
+
while(ISADDOP(ctx -> token))
{
int token = ctx -> token;
expr = oberon_make_bin_op(ctx, token, expr, inter);
}
- if(minus)
- {
- expr = oberon_make_unary_op(ctx, MINUS, expr);
- }
-
return expr;
}
oberon_scope_t * record_scope;
record_scope = oberon_open_scope(ctx);
- // TODO parent object
- //record_scope -> parent = NULL;
record_scope -> local = 1;
+ record_scope -> parent = NULL;
+ record_scope -> parent_type = rec;
oberon_assert_token(ctx, RECORD);
oberon_field_list(ctx, rec);
@@ -2198,7 +2201,8 @@ oberon_prevent_recursive_pointer(oberon_context_t * ctx, oberon_type_t * type)
oberon_error(ctx, "recursive pointer declaration");
}
- if(type -> base -> class == OBERON_TYPE_POINTER)
+ if(type -> class == OBERON_TYPE_POINTER
+ && type -> base -> class == OBERON_TYPE_POINTER)
{
oberon_error(ctx, "attempt to make pointer to pointer");
}
{
oberon_error(ctx, "module name not matched");
}
+
+ oberon_generator_fini_module(ctx -> mod);
}
// =======================================================================