From 0471db5bb6acb535678aa4badac7949f5a6effb4 Mon Sep 17 00:00:00 2001 From: svenbarth Date: Sat, 21 Nov 2015 10:52:19 +0000 Subject: [PATCH] pexpr.pas, factor.factor_read_id: * handle specializations after a type symbol git-svn-id: trunk@32387 - --- compiler/pexpr.pas | 40 +++++++++++++++++++++++++++++++++++----- 1 file changed, 35 insertions(+), 5 deletions(-) diff --git a/compiler/pexpr.pas b/compiler/pexpr.pas index 396a5a2a63..a5dc9f0ed0 100644 --- a/compiler/pexpr.pas +++ b/compiler/pexpr.pas @@ -2986,11 +2986,41 @@ implementation end else begin - { We need to know if this unit uses Variants } - if ((hdef=cvarianttype) or (hdef=colevarianttype)) and - not(cs_compilesystem in current_settings.moduleswitches) then - current_module.flags:=current_module.flags or uf_uses_variants; - p1:=handle_factor_typenode(hdef,getaddr,again,srsym,ef_type_only in flags); + if (m_delphi in current_settings.modeswitches) and + (sp_generic_dummy in srsym.symoptions) and + (token in [_LT,_LSHARPBRACKET]) then + begin + if block_type in [bt_type,bt_const_type,bt_var_type] then + begin + if not handle_specialize_inline_specialization(srsym,srsymtable,spezcontext) or (srsym.typ=procsym) then + begin + spezcontext.free; + p1:=cerrornode.create; + if try_to_consume(_LKLAMMER) then + begin + parse_paras(false,false,_RKLAMMER); + consume(_RKLAMMER); + end; + end + else + begin + if srsym.typ<>typesym then + internalerror(2015071705); + hdef:=ttypesym(srsym).typedef; + p1:=handle_factor_typenode(hdef,getaddr,again,srsym,ef_type_only in flags); + end; + end + else + p1:=cspecializenode.create(nil,getaddr,srsym) + end + else + begin + { We need to know if this unit uses Variants } + if ((hdef=cvarianttype) or (hdef=colevarianttype)) and + not(cs_compilesystem in current_settings.moduleswitches) then + current_module.flags:=current_module.flags or uf_uses_variants; + p1:=handle_factor_typenode(hdef,getaddr,again,srsym,ef_type_only in flags); + end; end; end;