DEADSOFTWARE

JVM: Реализован доступ к полям записей и NEW для записей(без инициализации полей)
[dsw-obn.git] / src / oberon.c
index 382f4f182b2e98ca1032a7f720cc575e58ae9fc5..09a6b8850c988e64986859aa3f2a73e3cd17d2ae 100644 (file)
@@ -131,8 +131,9 @@ oberon_open_scope(oberon_context_t * ctx)
 
        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;
@@ -1527,6 +1529,12 @@ oberon_simple_expr(oberon_context_t * ctx)
        }
 
        expr = oberon_term_expr(ctx);
+
+       if(minus)
+       {
+               expr = oberon_make_unary_op(ctx, MINUS, expr);
+       }
+
        while(ISADDOP(ctx -> token))
        {
                int token = ctx -> token;
@@ -1536,11 +1544,6 @@ oberon_simple_expr(oberon_context_t * ctx)
                expr = oberon_make_bin_op(ctx, token, expr, inter);
        }
 
-       if(minus)
-       {
-               expr = oberon_make_unary_op(ctx, MINUS, expr);
-       }
-
        return expr;
 }
 
@@ -2087,9 +2090,9 @@ oberon_type(oberon_context_t * ctx, oberon_type_t ** type)
 
                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);