diff options
-rw-r--r-- | compiler/pdecsub.pas | 18 | ||||
-rw-r--r-- | compiler/psub.pas | 1 |
2 files changed, 14 insertions, 5 deletions
diff --git a/compiler/pdecsub.pas b/compiler/pdecsub.pas index b261988154..cf263c0ad9 100644 --- a/compiler/pdecsub.pas +++ b/compiler/pdecsub.pas @@ -925,7 +925,7 @@ implementation isclassmethod, old_parse_generic, isgeneric, - popclass : boolean; + popextrasymtable : boolean; old_block_type : tblock_type; begin locationstr:=''; @@ -964,18 +964,26 @@ implementation old_parse_generic:=parse_generic; inc(testcurobject); { Add ObjectSymtable to be able to find generic type definitions } - popclass:=false; + popextrasymtable:=false; if assigned(pd._class) and (pd.parast.symtablelevel=normal_function_level) and (symtablestack.top.symtabletype<>ObjectSymtable) then begin symtablestack.push(pd._class.symtable); - popclass:=true; + popextrasymtable:=true; parse_generic:=(df_generic in pd._class.defoptions); + end + { generic function? } + else if (df_genericbase in pd.defoptions) then + begin + symtablestack.push(pd.parast); + popextrasymtable:=true; + parse_generic:=true; end; + single_type(pd.returndef,false); - if popclass then - symtablestack.pop(pd._class.symtable); + if popextrasymtable then + symtablestack.pop(symtablestack.top); dec(testcurobject); parse_generic:=old_parse_generic; diff --git a/compiler/psub.pas b/compiler/psub.pas index bc062e3b9e..20fb08c0ea 100644 --- a/compiler/psub.pas +++ b/compiler/psub.pas @@ -1746,6 +1746,7 @@ implementation end; _GENERIC: read_proc; + _SPECIALIZE: else break; end; |