diff options
author | jonas <jonas@3ad0048d-3df7-0310-abae-a5850022a9f2> | 2015-01-21 23:28:34 +0000 |
---|---|---|
committer | jonas <jonas@3ad0048d-3df7-0310-abae-a5850022a9f2> | 2015-01-21 23:28:34 +0000 |
commit | 1903b037de2fb3e75826406b46f055acb70963fa (patch) | |
tree | 604cd8b790fe14e5fbe441d4cd647c80d2a36a9a /compiler/nutils.pas | |
parent | ad1141d52f8353457053b925cd674fe1d5c4eafc (diff) | |
parent | 953d907e4d6c3a5c2f8aaee6e5e4f73c55ce5985 (diff) | |
download | fpc-blocks.tar.gz |
* synchronised with trunk till r29513blocks
git-svn-id: http://svn.freepascal.org/svn/fpc/branches/blocks@29516 3ad0048d-3df7-0310-abae-a5850022a9f2
Diffstat (limited to 'compiler/nutils.pas')
-rw-r--r-- | compiler/nutils.pas | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/compiler/nutils.pas b/compiler/nutils.pas index a802fffdf7..7cfa826a0d 100644 --- a/compiler/nutils.pas +++ b/compiler/nutils.pas @@ -1043,6 +1043,41 @@ implementation function handle_staticfield_access(sym: tsym; nested: boolean; var p1: tnode): boolean; + + function handle_generic_staticfield_access:boolean; + var + tmp : tstoreddef; + pd : tprocdef; + begin + { in case we have a specialization inside a generic (thus the static var sym does not + exist) we simply simulate a non static access to avoid unnecessary errors } + if assigned(sym.owner.defowner) and (df_specialization in tstoreddef(sym.owner.defowner).defoptions) then + begin + tmp:=tstoreddef(sym.owner.defowner); + while assigned(tmp) do + begin + if df_generic in tmp.defoptions then + begin + p1.free; + if assigned(current_procinfo) then + begin + pd:=current_procinfo.get_normal_proc.procdef; + if assigned(pd) and pd.no_self_node then + p1:=cloadvmtaddrnode.create(ctypenode.create(pd.struct)) + else + p1:=load_self_node; + end + else + p1:=load_self_node; + p1:=csubscriptnode.create(sym,p1); + exit(true); + end; + tmp:=tstoreddef(tmp.owner.defowner); + end; + end; + result:=false; + end; + var static_name: shortstring; srsymtable: tsymtable; @@ -1052,6 +1087,8 @@ implementation if (sp_static in sym.symoptions) then begin result:=true; + if handle_generic_staticfield_access then + exit; if not nested then static_name:=lower(sym.owner.name^)+'_'+sym.name else |