mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-29 12:20:28 +02:00
* improve pretty printing of symbols
This commit is contained in:
parent
79ed0db624
commit
906571fa25
@ -589,7 +589,7 @@ implementation
|
|||||||
end
|
end
|
||||||
else
|
else
|
||||||
if oo_is_sealed in childof.objectoptions then
|
if oo_is_sealed in childof.objectoptions then
|
||||||
Message1(parser_e_sealed_descendant,childof.typename)
|
Message1(parser_e_sealed_descendant,childof.typesymbolprettyname)
|
||||||
else
|
else
|
||||||
childof:=find_real_class_definition(childof,true);
|
childof:=find_real_class_definition(childof,true);
|
||||||
odt_interfacecorba,
|
odt_interfacecorba,
|
||||||
|
@ -2001,12 +2001,18 @@ uses
|
|||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
hadtypetoken:=false;
|
hadtypetoken:=false;
|
||||||
|
|
||||||
|
{ ensure a pretty name for error messages, might be chanced below }
|
||||||
|
if _prettyname<>'' then
|
||||||
|
ttypesym(srsym).fprettyname:=_prettyname
|
||||||
|
else
|
||||||
|
ttypesym(srsym).fprettyname:=prettyname;
|
||||||
|
|
||||||
read_named_type(result,srsym,genericdef,generictypelist,false,hadtypetoken);
|
read_named_type(result,srsym,genericdef,generictypelist,false,hadtypetoken);
|
||||||
ttypesym(srsym).typedef:=result;
|
ttypesym(srsym).typedef:=result;
|
||||||
result.typesym:=srsym;
|
result.typesym:=srsym;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
if _prettyname<>'' then
|
if _prettyname<>'' then
|
||||||
ttypesym(result.typesym).fprettyname:=_prettyname
|
ttypesym(result.typesym).fprettyname:=_prettyname
|
||||||
else
|
else
|
||||||
|
@ -162,6 +162,7 @@ interface
|
|||||||
function has_non_trivial_init_child(check_parent:boolean):boolean;override;
|
function has_non_trivial_init_child(check_parent:boolean):boolean;override;
|
||||||
function rtti_mangledname(rt:trttitype):TSymStr;override;
|
function rtti_mangledname(rt:trttitype):TSymStr;override;
|
||||||
function OwnerHierarchyName: string; override;
|
function OwnerHierarchyName: string; override;
|
||||||
|
function OwnerHierarchyPrettyName: string; override;
|
||||||
function fullownerhierarchyname(skipprocparams:boolean):TSymStr;override;
|
function fullownerhierarchyname(skipprocparams:boolean):TSymStr;override;
|
||||||
function needs_separate_initrtti:boolean;override;
|
function needs_separate_initrtti:boolean;override;
|
||||||
function in_currentunit: boolean;
|
function in_currentunit: boolean;
|
||||||
@ -2222,6 +2223,25 @@ implementation
|
|||||||
until tmp=nil;
|
until tmp=nil;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
function tstoreddef.OwnerHierarchyPrettyName: string;
|
||||||
|
var
|
||||||
|
tmp: tdef;
|
||||||
|
begin
|
||||||
|
tmp:=self;
|
||||||
|
result:='';
|
||||||
|
repeat
|
||||||
|
{ can be not assigned in case of a forwarddef }
|
||||||
|
if assigned(tmp.owner) and
|
||||||
|
(tmp.owner.symtabletype in [ObjectSymtable,recordsymtable]) then
|
||||||
|
tmp:=tdef(tmp.owner.defowner)
|
||||||
|
else
|
||||||
|
break;
|
||||||
|
result:=tabstractrecorddef(tmp).typesymbolprettyname+'.'+result;
|
||||||
|
until tmp=nil;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
function tstoreddef.fullownerhierarchyname(skipprocparams:boolean): TSymStr;
|
function tstoreddef.fullownerhierarchyname(skipprocparams:boolean): TSymStr;
|
||||||
var
|
var
|
||||||
lastowner: tsymtable;
|
lastowner: tsymtable;
|
||||||
|
@ -88,6 +88,7 @@ interface
|
|||||||
function getmangledparaname:TSymStr;virtual;
|
function getmangledparaname:TSymStr;virtual;
|
||||||
function rtti_mangledname(rt:trttitype):TSymStr;virtual;abstract;
|
function rtti_mangledname(rt:trttitype):TSymStr;virtual;abstract;
|
||||||
function OwnerHierarchyName: string; virtual; abstract;
|
function OwnerHierarchyName: string; virtual; abstract;
|
||||||
|
function OwnerHierarchyPrettyName: string; virtual; abstract;
|
||||||
function fullownerhierarchyname(skipprocparams:boolean):TSymStr;virtual;abstract;
|
function fullownerhierarchyname(skipprocparams:boolean):TSymStr;virtual;abstract;
|
||||||
function unique_id_str: string;
|
function unique_id_str: string;
|
||||||
function size:asizeint;virtual;abstract;
|
function size:asizeint;virtual;abstract;
|
||||||
@ -434,7 +435,7 @@ implementation
|
|||||||
|
|
||||||
function tdef.typesymbolprettyname:string;
|
function tdef.typesymbolprettyname:string;
|
||||||
begin
|
begin
|
||||||
result:=OwnerHierarchyName;
|
result:=OwnerHierarchyPrettyName;
|
||||||
if assigned(typesym) then
|
if assigned(typesym) then
|
||||||
result:=result+typesym.prettyname
|
result:=result+typesym.prettyname
|
||||||
else
|
else
|
||||||
@ -676,8 +677,14 @@ implementation
|
|||||||
|
|
||||||
|
|
||||||
function tsym.prettyname : string;
|
function tsym.prettyname : string;
|
||||||
|
var
|
||||||
|
i: SizeInt;
|
||||||
begin
|
begin
|
||||||
result:=realname;
|
result:=realname;
|
||||||
|
{ strip type parameters in the name separated by '$' }
|
||||||
|
i:=pos('$',result);
|
||||||
|
if i>0 then
|
||||||
|
delete(result,i,MaxInt);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user