From d86e726e87e279ea5c73e9c8d04c5f16e509f99a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20Van=20Canneyt?= Date: Thu, 27 Feb 2025 17:23:09 +0100 Subject: [PATCH] * Invoke helper also needs generic ids --- compiler/symcreat.pas | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/compiler/symcreat.pas b/compiler/symcreat.pas index 930bf33b73..cbab4c8f40 100644 --- a/compiler/symcreat.pas +++ b/compiler/symcreat.pas @@ -1229,8 +1229,13 @@ implementation end; function get_method_paramtype(vardef : Tdef; asPointer : Boolean; out isAnonymousArrayDef : Boolean) : ansistring; forward; - function str_parse_method(str: ansistring): tprocdef; forward; + function str_parse_method(str: ansistring; allowgenericid : boolean): tprocdef; forward; + + function str_parse_method(str: ansistring): tprocdef; + begin + Result:=str_parse_method(str,false); + end; procedure implement_invoke_helper(cn : string;pd: tprocdef; idx : integer); @@ -1299,7 +1304,7 @@ implementation end; str:=str+');'#10; str:=str+'end;'#10; - pd.invoke_helper:=str_parse_method(str); + pd.invoke_helper:=str_parse_method(str,true); end; procedure add_synthetic_method_implementations_for_st(st: tsymtable); @@ -1638,11 +1643,12 @@ implementation objdef.hiddenclassdef:=def; end; - function str_parse_method(str: ansistring): tprocdef; + function str_parse_method(str: ansistring; allowgenericid : boolean): tprocdef; var oldparse_only: boolean; tmpstr: ansistring; flags : tread_proc_flags; + oldallow : boolean; begin Message1(parser_d_internal_parser_string,str); @@ -1652,6 +1658,8 @@ implementation str:=str+'const;'; block_type:=bt_none; { inject the string in the scanner } + oldallow:=current_scanner.allowgenericid; + current_scanner.allowgenericid:=allowgenericid; current_scanner.substitutemacro('hidden_interface_method',@str[1],length(str),current_scanner.line_no,current_scanner.inputfile.ref_index,true); current_scanner.readtoken(false); Result:=read_proc([],Nil); @@ -1660,6 +1668,7 @@ implementation current_scanner.closeinputfile; current_scanner.nextfile; current_scanner.tempopeninputfile; + current_scanner.allowgenericid:=oldallow; end; @@ -1744,7 +1753,7 @@ implementation if HaveResult then str:=str+' Result:=res;'#10; str:=str+'end;'#10; - pd:=str_parse_method(str); + pd:=str_parse_method(str,true); end; procedure implement_thunkclass_interfacevmtoffset(cn : shortstring; objdef : tobjectdef; offs : integer);