summaryrefslogtreecommitdiff
path: root/closures/compiler/symdef.pas
diff options
context:
space:
mode:
authorblaise <blaise@3ad0048d-3df7-0310-abae-a5850022a9f2>2012-01-21 19:00:59 +0000
committerblaise <blaise@3ad0048d-3df7-0310-abae-a5850022a9f2>2012-01-21 19:00:59 +0000
commit377f14fd544f12a50c90e9a193ac782a601e83cd (patch)
tree04db9286a948d3c4f656e26de97b21bdd04d5070 /closures/compiler/symdef.pas
parent350adcb4b28481f4ae121a996c9f43dc019da18b (diff)
downloadfpc-377f14fd544f12a50c90e9a193ac782a601e83cd.tar.gz
~ ncgutil: generate interface thunks for local classes too
~ nld: during the first pass, we rewrite the nodes that load captured variables, except for nodes marked with the new flag loadnf_captured_param = pdecobj, symdef: factored out tobjectdef.register_implemented_interface + pexpr: access to captured variables from expressions; nameless routine declarations + symconst: new flags for tprocoption (po_nameless, po_has_closure) and tobjectoption (oo_is_nameless) ~ symdef: mangled name generator is now aware of local classes and interfaces + symsym: new field tabstractnormalvarsym.captured_into holds a reference to a new location for the captured variable git-svn-id: http://svn.freepascal.org/svn/fpc/branches/blaise@20138 3ad0048d-3df7-0310-abae-a5850022a9f2
Diffstat (limited to 'closures/compiler/symdef.pas')
-rw-r--r--closures/compiler/symdef.pas17
1 files changed, 17 insertions, 0 deletions
diff --git a/closures/compiler/symdef.pas b/closures/compiler/symdef.pas
index 6b9852fc52..4dea14eb01 100644
--- a/closures/compiler/symdef.pas
+++ b/closures/compiler/symdef.pas
@@ -312,7 +312,10 @@ interface
function members_need_inittable : boolean;
function find_implemented_interface(aintfdef:tobjectdef):TImplementedInterface;
{ this should be called when this class implements an interface }
+ procedure register_implemented_interface(const intfdef: tobjectdef);
+ strict private
procedure prepareguid;
+ public
function is_publishable : boolean;override;
function is_related(d : tdef) : boolean;override;
function needs_inittable : boolean;override;
@@ -907,10 +910,12 @@ implementation
i : longint;
crc : dword;
hp : tparavarsym;
+ label again; // TODO: refactor this abomination
begin
prefix:='';
if not assigned(st) then
internalerror(200204212);
+ again:
{ sub procedures }
while (st.symtabletype=localsymtable) do
begin
@@ -968,6 +973,9 @@ implementation
prefix:=tabstractrecorddef(st.defowner).objname^+'_$_'+prefix;
st:=st.defowner.owner;
end;
+ if st.symtabletype = localsymtable then
+ // local classes and interfaces
+ goto again;
{ symtable must now be static or global }
if not(st.symtabletype in [staticsymtable,globalsymtable]) then
internalerror(200204175);
@@ -4859,6 +4867,15 @@ implementation
end;
+ procedure tobjectdef.register_implemented_interface(const intfdef: tobjectdef);
+ begin
+ // allocate the GUID only if the class implements at least one interface
+ if ImplementedInterfaces.count = 0 then
+ prepareguid;
+ ImplementedInterfaces.Add(TImplementedInterface.Create(intfdef));
+ end;
+
+
procedure tobjectdef.prepareguid;
begin
{ set up guid }