@@ -1207,17 +1207,10 @@ package body Tree_Walk is
1207
1207
Set_Type (Sym, Symbol_Type);
1208
1208
1209
1209
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);
1221
1214
end if ;
1222
1215
1223
1216
if Is_Out_Param then
@@ -2940,6 +2933,13 @@ package body Tree_Walk is
2940
2933
end if ;
2941
2934
end Make_Default_Initialiser ;
2942
2935
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
+
2943
2943
-- Begin processing for Do_Object_Declaration_Full_Declaration
2944
2944
begin
2945
2945
Set_Source_Location (Decl, (Sloc (N)));
@@ -2961,12 +2961,17 @@ package body Tree_Walk is
2961
2961
end ;
2962
2962
end if ;
2963
2963
2964
+ pragma Assert (Get_Identifier (Id) = Unintern (Obj_Id));
2964
2965
if not Global_Symbol_Table.Contains (Obj_Id)
2965
2966
then
2966
2967
New_Object_Symbol_Entry (Object_Name => Obj_Id,
2967
2968
Object_Type => Obj_Type,
2968
2969
Object_Init_Value => Init_Expr,
2969
2970
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 );
2970
2975
end if ;
2971
2976
2972
2977
if Init_Expr /= Ireps.Empty then
@@ -2975,12 +2980,6 @@ package body Tree_Walk is
2975
2980
Global_Symbol_Table),
2976
2981
Source_Location => Sloc (N)));
2977
2982
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
-
2984
2983
end Do_Object_Declaration_Full ;
2985
2984
2986
2985
-- -----------------------
0 commit comments