|
@@ -769,6 +769,13 @@ interface
|
|
end;
|
|
end;
|
|
pinlininginfo = ^tinlininginfo;
|
|
pinlininginfo = ^tinlininginfo;
|
|
|
|
|
|
|
|
+ tcapturedsyminfo = record
|
|
|
|
+ sym : tsym;
|
|
|
|
+ { the location where the symbol was first encountered }
|
|
|
|
+ fileinfo : tfileposinfo;
|
|
|
|
+ end;
|
|
|
|
+ pcapturedsyminfo = ^tcapturedsyminfo;
|
|
|
|
+
|
|
timplprocdefinfo = record
|
|
timplprocdefinfo = record
|
|
resultname : pshortstring;
|
|
resultname : pshortstring;
|
|
parentfpstruct: tsym;
|
|
parentfpstruct: tsym;
|
|
@@ -782,6 +789,7 @@ interface
|
|
interfacedef : boolean;
|
|
interfacedef : boolean;
|
|
hasforward : boolean;
|
|
hasforward : boolean;
|
|
is_implemented : boolean;
|
|
is_implemented : boolean;
|
|
|
|
+ capturedsyms : tfplist;
|
|
end;
|
|
end;
|
|
pimplprocdefinfo = ^timplprocdefinfo;
|
|
pimplprocdefinfo = ^timplprocdefinfo;
|
|
|
|
|
|
@@ -829,6 +837,7 @@ interface
|
|
procedure SetHasInliningInfo(AValue: boolean);
|
|
procedure SetHasInliningInfo(AValue: boolean);
|
|
function Getis_implemented: boolean;
|
|
function Getis_implemented: boolean;
|
|
procedure Setis_implemented(AValue: boolean);
|
|
procedure Setis_implemented(AValue: boolean);
|
|
|
|
+ function Getcapturedsyms:tfplist;
|
|
function getparentfpsym: tsym;
|
|
function getparentfpsym: tsym;
|
|
public
|
|
public
|
|
messageinf : tmessageinf;
|
|
messageinf : tmessageinf;
|
|
@@ -915,6 +924,8 @@ interface
|
|
function get_funcretsym_info(out ressym: tsym; out resdef: tdef): boolean; virtual;
|
|
function get_funcretsym_info(out ressym: tsym; out resdef: tdef): boolean; virtual;
|
|
function get_safecall_funcretsym_info(out ressym: tsym; out resdef: tdef): boolean; virtual;
|
|
function get_safecall_funcretsym_info(out ressym: tsym; out resdef: tdef): boolean; virtual;
|
|
|
|
|
|
|
|
+ procedure add_captured_sym(sym:tsym;const filepos:tfileposinfo);
|
|
|
|
+
|
|
{ returns whether the mangled name or any of its aliases is equal to
|
|
{ returns whether the mangled name or any of its aliases is equal to
|
|
s }
|
|
s }
|
|
function has_alias_name(const s: TSymStr):boolean;
|
|
function has_alias_name(const s: TSymStr):boolean;
|
|
@@ -959,6 +970,8 @@ interface
|
|
property parentfpsym: tsym read getparentfpsym;
|
|
property parentfpsym: tsym read getparentfpsym;
|
|
{ true if the implementation part for this procdef has been handled }
|
|
{ true if the implementation part for this procdef has been handled }
|
|
property is_implemented: boolean read Getis_implemented write Setis_implemented;
|
|
property is_implemented: boolean read Getis_implemented write Setis_implemented;
|
|
|
|
+ { valid if the procdef captures any symbols from outer scopes }
|
|
|
|
+ property capturedsyms:tfplist read Getcapturedsyms;
|
|
end;
|
|
end;
|
|
tprocdefclass = class of tprocdef;
|
|
tprocdefclass = class of tprocdef;
|
|
|
|
|
|
@@ -6075,6 +6088,15 @@ implementation
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
+ function tprocdef.Getcapturedsyms:tfplist;
|
|
|
|
+ begin
|
|
|
|
+ if not assigned(implprocdefinfo) then
|
|
|
|
+ result:=nil
|
|
|
|
+ else
|
|
|
|
+ result:=implprocdefinfo^.capturedsyms;
|
|
|
|
+ end;
|
|
|
|
+
|
|
|
|
+
|
|
function tprocdef.store_localst: boolean;
|
|
function tprocdef.store_localst: boolean;
|
|
begin
|
|
begin
|
|
result:=has_inlininginfo or (df_generic in defoptions);
|
|
result:=has_inlininginfo or (df_generic in defoptions);
|
|
@@ -6483,10 +6505,19 @@ implementation
|
|
|
|
|
|
|
|
|
|
procedure tprocdef.freeimplprocdefinfo;
|
|
procedure tprocdef.freeimplprocdefinfo;
|
|
|
|
+ var
|
|
|
|
+ i : longint;
|
|
begin
|
|
begin
|
|
if assigned(implprocdefinfo) then
|
|
if assigned(implprocdefinfo) then
|
|
begin
|
|
begin
|
|
stringdispose(implprocdefinfo^.resultname);
|
|
stringdispose(implprocdefinfo^.resultname);
|
|
|
|
+ if assigned(implprocdefinfo^.capturedsyms) then
|
|
|
|
+ begin
|
|
|
|
+ for i:=0 to implprocdefinfo^.capturedsyms.count-1 do
|
|
|
|
+ dispose(pcapturedsyminfo(implprocdefinfo^.capturedsyms[i]));
|
|
|
|
+ end;
|
|
|
|
+ implprocdefinfo^.capturedsyms.free;
|
|
|
|
+ implprocdefinfo^.capturedsyms:=nil;
|
|
freemem(implprocdefinfo);
|
|
freemem(implprocdefinfo);
|
|
implprocdefinfo:=nil;
|
|
implprocdefinfo:=nil;
|
|
end;
|
|
end;
|
|
@@ -6784,6 +6815,28 @@ implementation
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
+ procedure tprocdef.add_captured_sym(sym:tsym;const filepos:tfileposinfo);
|
|
|
|
+ var
|
|
|
|
+ i : longint;
|
|
|
|
+ capturedsym : pcapturedsyminfo;
|
|
|
|
+ begin
|
|
|
|
+ if not assigned(implprocdefinfo) then
|
|
|
|
+ internalerror(2021052601);
|
|
|
|
+ if not assigned(implprocdefinfo^.capturedsyms) then
|
|
|
|
+ implprocdefinfo^.capturedsyms:=tfplist.create;
|
|
|
|
+ for i:=0 to implprocdefinfo^.capturedsyms.count-1 do
|
|
|
|
+ begin
|
|
|
|
+ capturedsym:=pcapturedsyminfo(implprocdefinfo^.capturedsyms[i]);
|
|
|
|
+ if capturedsym^.sym=sym then
|
|
|
|
+ exit;
|
|
|
|
+ end;
|
|
|
|
+ new(capturedsym);
|
|
|
|
+ capturedsym^.sym:=sym;
|
|
|
|
+ capturedsym^.fileinfo:=filepos;
|
|
|
|
+ implprocdefinfo^.capturedsyms.add(capturedsym);
|
|
|
|
+ end;
|
|
|
|
+
|
|
|
|
+
|
|
function tprocdef.has_alias_name(const s: TSymStr): boolean;
|
|
function tprocdef.has_alias_name(const s: TSymStr): boolean;
|
|
var
|
|
var
|
|
item : TCmdStrListItem;
|
|
item : TCmdStrListItem;
|