diff options
author | jonas <jonas@3ad0048d-3df7-0310-abae-a5850022a9f2> | 2015-05-31 16:50:44 +0000 |
---|---|---|
committer | jonas <jonas@3ad0048d-3df7-0310-abae-a5850022a9f2> | 2015-05-31 16:50:44 +0000 |
commit | f43b6f750a34357a13d92e4ee43149683535e2ba (patch) | |
tree | b5b534bd43c57d49a4744439d176c87078b6115a /compiler/nld.pas | |
parent | 3a2e8ed92bd9cb5e0f47297dba53f28e6001131b (diff) | |
download | fpc-f43b6f750a34357a13d92e4ee43149683535e2ba.tar.gz |
- removed most special handling of self (the self parameter has had the
correct type since quite a while)
o exceptions:
o objects/records (self is a "var" parameter there, and sometimes
we want to load it as a pointer to an object instead
o Objective-C class methods, where self has to be id (to have a signature
compatible with what Objective-C compilers generate), but when loading
it we want a classrefdef of the current class for type check and
method resolving
git-svn-id: http://svn.freepascal.org/svn/fpc/trunk@30949 3ad0048d-3df7-0310-abae-a5850022a9f2
Diffstat (limited to 'compiler/nld.pas')
-rw-r--r-- | compiler/nld.pas | 27 |
1 files changed, 12 insertions, 15 deletions
diff --git a/compiler/nld.pas b/compiler/nld.pas index 3ac96aa253..a0519f32f6 100644 --- a/compiler/nld.pas +++ b/compiler/nld.pas @@ -333,27 +333,24 @@ implementation { and behaves as if its address escapes its parent block } make_not_regable(self,[ra_addr_taken]); end; - { fix self type which is declared as voidpointer in the - definition } - if vo_is_self in tabstractvarsym(symtableentry).varoptions then + resultdef:=tabstractvarsym(symtableentry).vardef; + { self for objects is passed as var-parameter on the caller + side, but on the callee-side we use it as a pointer -> + adjust } + if (vo_is_self in tabstractvarsym(symtableentry).varoptions) then begin - resultdef:=tprocdef(symtableentry.owner.defowner).struct; - if is_objectpascal_helper(resultdef) then - resultdef:=tobjectdef(resultdef).extendeddef; - if (po_classmethod in tprocdef(symtableentry.owner.defowner).procoptions) or - (po_staticmethod in tprocdef(symtableentry.owner.defowner).procoptions) then - resultdef:=cclassrefdef.create(resultdef) - else if (is_object(resultdef) or is_record(resultdef)) and - (loadnf_load_self_pointer in loadnodeflags) then - resultdef:=getpointerdef(resultdef); + if (is_object(resultdef) or is_record(resultdef)) and + (loadnf_load_self_pointer in loadnodeflags) then + resultdef:=getpointerdef(resultdef) + else if (resultdef=objc_idtype) and + (po_classmethod in tprocdef(symtableentry.owner.defowner).procoptions) then + resultdef:=cclassrefdef.create(tprocdef(symtableentry.owner.defowner).struct) end else if vo_is_vmt in tabstractvarsym(symtableentry).varoptions then begin resultdef:=tprocdef(symtableentry.owner.defowner).struct; resultdef:=cclassrefdef.create(resultdef); - end - else - resultdef:=tabstractvarsym(symtableentry).vardef; + end; end; procsym : begin |