get rid of some fields in ast_t: outer_fkt_jmp, is_outer_ref, is_parameter
authorMatthias Braun <matze@braunis.de>
Sat, 25 Oct 2008 17:10:15 +0000 (17:10 +0000)
committerMatthias Braun <matze@braunis.de>
Sat, 25 Oct 2008 17:10:15 +0000 (17:10 +0000)
[r23181]

ast2firm.c
ast_t.h
parser.c

index bd59f51..40ad71d 100644 (file)
@@ -1450,12 +1450,7 @@ static ir_node *reference_expression_to_firm(const reference_expression_t *ref)
 
        case DECLARATION_KIND_ENUM_ENTRY: {
                ir_mode *const mode = get_ir_mode(type);
-               if (ref->is_outer_ref) {
-                       /* reference to an outer variable */
-                       panic("Outer variable reference not implemented");
-               } else {
-                       return new_Const(mode, declaration->v.enum_val);
-               }
+               return new_Const(mode, declaration->v.enum_val);
        }
 
        case DECLARATION_KIND_LOCAL_VARIABLE: {
@@ -4722,14 +4717,9 @@ static void goto_to_firm(const goto_statement_t *statement)
                set_irn_link(ijmp, ijmp_list);
                ijmp_list = ijmp;
        } else {
-               if (statement->outer_fkt_jmp) {
-                       /* TODO: this is a outer function jmp */
-                       panic("outer function jump not implemented");
-               } else {
-                       ir_node *block = get_label_block(statement->label);
-                       ir_node *jmp   = new_Jmp();
-                       add_immBlock_pred(block, jmp);
-               }
+               ir_node *block = get_label_block(statement->label);
+               ir_node *jmp   = new_Jmp();
+               add_immBlock_pred(block, jmp);
        }
        set_cur_block(NULL);
 }
diff --git a/ast_t.h b/ast_t.h
index c19adc1..6d43caf 100644 (file)
--- a/ast_t.h
+++ b/ast_t.h
@@ -191,7 +191,6 @@ struct scope_t {
        declaration_t *last_declaration;  /**< last declaration in this scope. */
        scope_t       *parent;            /**< points to the parent scope. */
        unsigned      depth;              /**< while parsing, the depth of this scope in the scope stack. */
-       bool          is_parameter;       /**< Set if this scope is a parameter scope. */
 };
 
 struct expression_base_t {
@@ -257,8 +256,6 @@ struct builtin_prefetch_expression_t {
 struct reference_expression_t {
        expression_base_t  base;
        declaration_t     *declaration;
-       bool               is_outer_ref;  /**< Set, if this referenced a variable
-                                              outside of an inner function */
 };
 
 struct call_argument_t {
@@ -676,7 +673,6 @@ struct goto_statement_t {
        declaration_t    *label;         /**< The destination label. */
        expression_t     *expression;    /**< The expression for an assigned goto. */
        goto_statement_t *next;          /**< links all goto statements of a function */
-       bool              outer_fkt_jmp; /**< Set if this goto jump to an outer function. */
 };
 
 struct case_label_statement_t {
index 3ab7b07..97e04cd 100644 (file)
--- a/parser.c
+++ b/parser.c
@@ -4189,7 +4189,6 @@ static construct_type_t *parse_function_declarator(declaration_t *declaration)
        if (declaration != NULL) {
                declaration->scope.declarations     = parameters;
                declaration->scope.last_declaration = last;
-               declaration->scope.is_parameter     = true;
        }
 
        construct_function_type_t *construct_function_type =
@@ -4610,7 +4609,7 @@ static declaration_t *record_declaration(
 
        assert(declaration != previous_declaration);
        if (previous_declaration != NULL &&
-           previous_declaration->parent_scope->is_parameter &&
+           previous_declaration->parent_scope == &current_function->scope &&
            scope->depth == previous_declaration->parent_scope->depth + 1) {
                errorf(&declaration->source_position,
                        "declaration '%#T' redeclares the parameter '%#T' (declared %P)",
@@ -6343,7 +6342,6 @@ static expression_t *parse_reference(void)
            is_type_valid(orig_type) && !is_type_function(orig_type)) {
                /* access of a variable from an outer function */
                declaration->address_taken     = true;
-               ref->is_outer_ref              = true;
                current_function->need_closure = true;
        }
 
@@ -9500,10 +9498,6 @@ static statement_t *parse_goto(void)
                next_token();
 
                statement->gotos.label = get_label(symbol);
-
-               if (statement->gotos.label->parent_scope->depth < current_function->scope.depth) {
-                       statement->gotos.outer_fkt_jmp = true;
-               }
        }
 
        /* remember the goto's in a list for later checking */