@@ -1207,17 +1207,10 @@ package body Tree_Walk is
12071207 Set_Type (Sym, Symbol_Type);
12081208
12091209 if not Global_Symbol_Table.Contains (Sym_Id) then
1210- declare
1211- Variable_Symbol : Symbol;
1212- begin
1213- Variable_Symbol.Name := Sym_Id;
1214- Variable_Symbol.BaseName := Sym_Id;
1215- Variable_Symbol.PrettyName := Intern (Get_Name_String (Chars (E)));
1216- Variable_Symbol.SymType := Symbol_Type;
1217- Variable_Symbol.Mode := Intern (" C" );
1218- Variable_Symbol.Value := Make_Nil (Sloc (E));
1219- Global_Symbol_Table.Insert (Sym_Id, Variable_Symbol);
1220- end ;
1210+ New_Object_Symbol_Entry (Object_Name => Sym_Id,
1211+ Object_Type => Symbol_Type,
1212+ Object_Init_Value => Make_Nil (Sloc (E)),
1213+ A_Symbol_Table => Global_Symbol_Table);
12211214 end if ;
12221215
12231216 if Is_Out_Param then
@@ -2940,6 +2933,13 @@ package body Tree_Walk is
29402933 end if ;
29412934 end Make_Default_Initialiser ;
29422935
2936+ procedure Update_Value (Key : Symbol_Id; Element : in out Symbol);
2937+ procedure Update_Value (Key : Symbol_Id; Element : in out Symbol) is
2938+ begin
2939+ pragma Assert (Unintern (Key) = Unintern (Obj_Id));
2940+ Element.Value := Init_Expr;
2941+ end Update_Value ;
2942+
29432943 -- Begin processing for Do_Object_Declaration_Full_Declaration
29442944 begin
29452945 Set_Source_Location (Decl, (Sloc (N)));
@@ -2961,12 +2961,17 @@ package body Tree_Walk is
29612961 end ;
29622962 end if ;
29632963
2964+ pragma Assert (Get_Identifier (Id) = Unintern (Obj_Id));
29642965 if not Global_Symbol_Table.Contains (Obj_Id)
29652966 then
29662967 New_Object_Symbol_Entry (Object_Name => Obj_Id,
29672968 Object_Type => Obj_Type,
29682969 Object_Init_Value => Init_Expr,
29692970 A_Symbol_Table => Global_Symbol_Table);
2971+ elsif Init_Expr /= Ireps.Empty then
2972+ Global_Symbol_Table.Update_Element
2973+ (Position => Global_Symbol_Table.Find (Obj_Id),
2974+ Process => Update_Value'Access );
29702975 end if ;
29712976
29722977 if Init_Expr /= Ireps.Empty then
@@ -2975,12 +2980,6 @@ package body Tree_Walk is
29752980 Global_Symbol_Table),
29762981 Source_Location => Sloc (N)));
29772982 end if ;
2978-
2979- if not Global_Symbol_Table.Contains (Intern (Get_Identifier (Id))) then
2980- Register_Identifier_In_Symbol_Table
2981- (Id, Init_Expr, Global_Symbol_Table);
2982- end if ;
2983-
29842983 end Do_Object_Declaration_Full ;
29852984
29862985 -- -----------------------
0 commit comments