|
@@ -175,7 +175,7 @@ implementation
|
|
name that can be used in generated Pascal code without risking an
|
|
name that can be used in generated Pascal code without risking an
|
|
identifier conflict (since it is local to this class; the global name
|
|
identifier conflict (since it is local to this class; the global name
|
|
is unique because it's an identifier that contains $-signs) }
|
|
is unique because it's an identifier that contains $-signs) }
|
|
- enumclass.symtable.insert(ctypesym.create('__FPC_TEnumClassAlias',enumclass));
|
|
|
|
|
|
+ enumclass.symtable.insertsym(ctypesym.create('__FPC_TEnumClassAlias',enumclass));
|
|
|
|
|
|
{ also create an alias for the enum type so that we can iterate over
|
|
{ also create an alias for the enum type so that we can iterate over
|
|
all enum values when creating the body of the class constructor }
|
|
all enum values when creating the body of the class constructor }
|
|
@@ -183,7 +183,7 @@ implementation
|
|
{ don't pass def to the ttypesym constructor, because then it
|
|
{ don't pass def to the ttypesym constructor, because then it
|
|
will replace the current (real) typesym of that def with the alias }
|
|
will replace the current (real) typesym of that def with the alias }
|
|
temptypesym.typedef:=def;
|
|
temptypesym.typedef:=def;
|
|
- enumclass.symtable.insert(temptypesym);
|
|
|
|
|
|
+ enumclass.symtable.insertsym(temptypesym);
|
|
{ but the name of the class as far as the JVM is concerned will match
|
|
{ but the name of the class as far as the JVM is concerned will match
|
|
the enum's original name (the enum type itself won't be output in
|
|
the enum's original name (the enum type itself won't be output in
|
|
any class file, so no conflict there)
|
|
any class file, so no conflict there)
|
|
@@ -212,14 +212,14 @@ implementation
|
|
for i:=0 to tenumdef(def).symtable.symlist.count-1 do
|
|
for i:=0 to tenumdef(def).symtable.symlist.count-1 do
|
|
begin
|
|
begin
|
|
fsym:=cfieldvarsym.create(tenumsym(tenumdef(def).symtable.symlist[i]).realname,vs_final,enumclass,[]);
|
|
fsym:=cfieldvarsym.create(tenumsym(tenumdef(def).symtable.symlist[i]).realname,vs_final,enumclass,[]);
|
|
- enumclass.symtable.insert(fsym);
|
|
|
|
|
|
+ enumclass.symtable.insertsym(fsym);
|
|
sym:=make_field_static(enumclass.symtable,fsym);
|
|
sym:=make_field_static(enumclass.symtable,fsym);
|
|
{ add alias for the field representing ordinal(0), for use in
|
|
{ add alias for the field representing ordinal(0), for use in
|
|
initialization code }
|
|
initialization code }
|
|
if tenumsym(tenumdef(def).symtable.symlist[i]).value=0 then
|
|
if tenumsym(tenumdef(def).symtable.symlist[i]).value=0 then
|
|
begin
|
|
begin
|
|
aliassym:=cstaticvarsym.create('__FPC_Zero_Initializer',vs_final,enumclass,[vo_is_external]);
|
|
aliassym:=cstaticvarsym.create('__FPC_Zero_Initializer',vs_final,enumclass,[vo_is_external]);
|
|
- enumclass.symtable.insert(aliassym);
|
|
|
|
|
|
+ enumclass.symtable.insertsym(aliassym);
|
|
aliassym.set_raw_mangledname(sym.mangledname);
|
|
aliassym.set_raw_mangledname(sym.mangledname);
|
|
end;
|
|
end;
|
|
end;
|
|
end;
|
|
@@ -228,7 +228,7 @@ implementation
|
|
arrdef:=carraydef.create(0,tenumdef(def).symtable.symlist.count-1,s32inttype);
|
|
arrdef:=carraydef.create(0,tenumdef(def).symtable.symlist.count-1,s32inttype);
|
|
arrdef.elementdef:=enumclass;
|
|
arrdef.elementdef:=enumclass;
|
|
arrsym:=ctypesym.create('__FPC_TEnumValues',arrdef);
|
|
arrsym:=ctypesym.create('__FPC_TEnumValues',arrdef);
|
|
- enumclass.symtable.insert(arrsym);
|
|
|
|
|
|
+ enumclass.symtable.insertsym(arrsym);
|
|
{ insert "public static values: array of enumclass" that returns $VALUES.clone()
|
|
{ insert "public static values: array of enumclass" that returns $VALUES.clone()
|
|
(rather than a dynamic array and using clone --which we don't support yet for arrays--
|
|
(rather than a dynamic array and using clone --which we don't support yet for arrays--
|
|
simply use a fixed length array and copy it) }
|
|
simply use a fixed length array and copy it) }
|
|
@@ -242,12 +242,12 @@ implementation
|
|
begin
|
|
begin
|
|
{ add field for the value }
|
|
{ add field for the value }
|
|
fsym:=cfieldvarsym.create('__fpc_fenumval',vs_final,s32inttype,[]);
|
|
fsym:=cfieldvarsym.create('__fpc_fenumval',vs_final,s32inttype,[]);
|
|
- enumclass.symtable.insert(fsym);
|
|
|
|
|
|
+ enumclass.symtable.insertsym(fsym);
|
|
tobjectsymtable(enumclass.symtable).addfield(fsym,vis_strictprivate);
|
|
tobjectsymtable(enumclass.symtable).addfield(fsym,vis_strictprivate);
|
|
{ add class field with hash table that maps from FPC-declared ordinal value -> enum instance }
|
|
{ add class field with hash table that maps from FPC-declared ordinal value -> enum instance }
|
|
juhashmap:=search_system_type('JUHASHMAP').typedef;
|
|
juhashmap:=search_system_type('JUHASHMAP').typedef;
|
|
fsym:=cfieldvarsym.create('__fpc_ord2enum',vs_final,juhashmap,[]);
|
|
fsym:=cfieldvarsym.create('__fpc_ord2enum',vs_final,juhashmap,[]);
|
|
- enumclass.symtable.insert(fsym);
|
|
|
|
|
|
+ enumclass.symtable.insertsym(fsym);
|
|
make_field_static(enumclass.symtable,fsym);
|
|
make_field_static(enumclass.symtable,fsym);
|
|
{ add custom constructor }
|
|
{ add custom constructor }
|
|
if not str_parse_method_dec('constructor Create(const __fpc_name: JLString; const __fpc_ord, __fpc_initenumval: longint);',potype_constructor,false,enumclass,pd) then
|
|
if not str_parse_method_dec('constructor Create(const __fpc_name: JLString; const __fpc_ord, __fpc_initenumval: longint);',potype_constructor,false,enumclass,pd) then
|
|
@@ -305,12 +305,12 @@ implementation
|
|
checking when creating the "Values" method }
|
|
checking when creating the "Values" method }
|
|
fsym:=cfieldvarsym.create('$VALUES',vs_final,arrdef,[]);
|
|
fsym:=cfieldvarsym.create('$VALUES',vs_final,arrdef,[]);
|
|
fsym.visibility:=vis_strictprivate;
|
|
fsym.visibility:=vis_strictprivate;
|
|
- enumclass.symtable.insert(fsym,false);
|
|
|
|
|
|
+ enumclass.symtable.insertsym(fsym,false);
|
|
sym:=make_field_static(enumclass.symtable,fsym);
|
|
sym:=make_field_static(enumclass.symtable,fsym);
|
|
{ alias for accessing the field in generated Pascal code }
|
|
{ alias for accessing the field in generated Pascal code }
|
|
sl:=tpropaccesslist.create;
|
|
sl:=tpropaccesslist.create;
|
|
sl.addsym(sl_load,sym);
|
|
sl.addsym(sl_load,sym);
|
|
- enumclass.symtable.insert(cabsolutevarsym.create_ref('__fpc_FVALUES',arrdef,sl));
|
|
|
|
|
|
+ enumclass.symtable.insertsym(cabsolutevarsym.create_ref('__fpc_FVALUES',arrdef,sl));
|
|
{ add initialization of the static class fields created above }
|
|
{ add initialization of the static class fields created above }
|
|
if not str_parse_method_dec('constructor fpc_enum_class_constructor;',potype_class_constructor,true,enumclass,pd) then
|
|
if not str_parse_method_dec('constructor fpc_enum_class_constructor;',potype_class_constructor,true,enumclass,pd) then
|
|
internalerror(2011062303);
|
|
internalerror(2011062303);
|
|
@@ -356,7 +356,7 @@ implementation
|
|
if df_generic in def.defoptions then
|
|
if df_generic in def.defoptions then
|
|
include(pvclass.defoptions,df_generic);
|
|
include(pvclass.defoptions,df_generic);
|
|
{ associate typesym }
|
|
{ associate typesym }
|
|
- pvclass.symtable.insert(ctypesym.create('__FPC_TProcVarClassAlias',pvclass));
|
|
|
|
|
|
+ pvclass.symtable.insertsym(ctypesym.create('__FPC_TProcVarClassAlias',pvclass));
|
|
{ set external name to match procvar type name }
|
|
{ set external name to match procvar type name }
|
|
if not islocal then
|
|
if not islocal then
|
|
pvclass.objextname:=stringdup(name)
|
|
pvclass.objextname:=stringdup(name)
|
|
@@ -381,7 +381,7 @@ implementation
|
|
{ don't pass def to the ttypesym constructor, because then it
|
|
{ don't pass def to the ttypesym constructor, because then it
|
|
will replace the current (real) typesym of that def with the alias }
|
|
will replace the current (real) typesym of that def with the alias }
|
|
temptypesym.typedef:=def;
|
|
temptypesym.typedef:=def;
|
|
- pvclass.symtable.insert(temptypesym);
|
|
|
|
|
|
+ pvclass.symtable.insertsym(temptypesym);
|
|
|
|
|
|
{ in case of a procedure of object, add a nested interface type that
|
|
{ in case of a procedure of object, add a nested interface type that
|
|
has one method that conforms to the procvartype (with name
|
|
has one method that conforms to the procvartype (with name
|
|
@@ -398,7 +398,7 @@ implementation
|
|
if df_generic in def.defoptions then
|
|
if df_generic in def.defoptions then
|
|
include(pvintf.defoptions,df_generic);
|
|
include(pvintf.defoptions,df_generic);
|
|
{ associate typesym }
|
|
{ associate typesym }
|
|
- pvclass.symtable.insert(ctypesym.create('Callback',pvintf));
|
|
|
|
|
|
+ pvclass.symtable.insertsym(ctypesym.create('Callback',pvintf));
|
|
|
|
|
|
{ add a method prototype matching the procvar (like the invoke
|
|
{ add a method prototype matching the procvar (like the invoke
|
|
in the procvarclass itself) }
|
|
in the procvarclass itself) }
|
|
@@ -507,7 +507,7 @@ implementation
|
|
Pascal code }
|
|
Pascal code }
|
|
typ:=ctypesym.create('__fpc_virtualclassmethod_pv_t'+wrapperpd.unique_id_str,wrapperpv);
|
|
typ:=ctypesym.create('__fpc_virtualclassmethod_pv_t'+wrapperpd.unique_id_str,wrapperpv);
|
|
wrapperpv.classdef.typesym.visibility:=vis_strictprivate;
|
|
wrapperpv.classdef.typesym.visibility:=vis_strictprivate;
|
|
- symtablestack.top.insert(typ);
|
|
|
|
|
|
+ symtablestack.top.insertsym(typ);
|
|
symtablestack.pop(pd.owner);
|
|
symtablestack.pop(pd.owner);
|
|
end;
|
|
end;
|
|
|
|
|
|
@@ -595,7 +595,7 @@ implementation
|
|
{ make sure we don't emit a definition for this field (we'll do
|
|
{ make sure we don't emit a definition for this field (we'll do
|
|
that for the constsym already) -> mark as external }
|
|
that for the constsym already) -> mark as external }
|
|
ssym:=cstaticvarsym.create(internal_static_field_name(csym.realname),vs_final,csym.constdef,[vo_is_external]);
|
|
ssym:=cstaticvarsym.create(internal_static_field_name(csym.realname),vs_final,csym.constdef,[vo_is_external]);
|
|
- csym.owner.insert(ssym);
|
|
|
|
|
|
+ csym.owner.insertsym(ssym);
|
|
{ alias storage to the constsym }
|
|
{ alias storage to the constsym }
|
|
ssym.set_mangledname(csym.realname);
|
|
ssym.set_mangledname(csym.realname);
|
|
for i:=0 to tenumdef(csym.constdef).symtable.symlist.count-1 do
|
|
for i:=0 to tenumdef(csym.constdef).symtable.symlist.count-1 do
|
|
@@ -633,7 +633,7 @@ implementation
|
|
}
|
|
}
|
|
symtablestack.push(current_module.localsymtable);
|
|
symtablestack.push(current_module.localsymtable);
|
|
ssym:=cstaticvarsym.create(internal_static_field_name(csym.realname),vs_final,tsetdef(csym.constdef).getcopy,[vo_is_external,vo_has_local_copy]);
|
|
ssym:=cstaticvarsym.create(internal_static_field_name(csym.realname),vs_final,tsetdef(csym.constdef).getcopy,[vo_is_external,vo_has_local_copy]);
|
|
- symtablestack.top.insert(ssym);
|
|
|
|
|
|
+ symtablestack.top.insertsym(ssym);
|
|
symtablestack.pop(current_module.localsymtable);
|
|
symtablestack.pop(current_module.localsymtable);
|
|
{ alias storage to the constsym }
|
|
{ alias storage to the constsym }
|
|
ssym.set_mangledname(csym.realname);
|
|
ssym.set_mangledname(csym.realname);
|