summaryrefslogtreecommitdiff
path: root/closures/compiler/ncgutil.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/ncgutil.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/ncgutil.pas')
-rw-r--r--closures/compiler/ncgutil.pas13
1 files changed, 10 insertions, 3 deletions
diff --git a/closures/compiler/ncgutil.pas b/closures/compiler/ncgutil.pas
index 093708bf55..be668fd0cb 100644
--- a/closures/compiler/ncgutil.pas
+++ b/closures/compiler/ncgutil.pas
@@ -3075,9 +3075,16 @@ implementation
for i:=0 to st.DefList.Count-1 do
begin
def:=tdef(st.DefList[i]);
- { if def can contain nested types then handle it symtable }
- if def.typ in [objectdef,recorddef] then
- gen_intf_wrappers(list,tabstractrecorddef(def).symtable,true);
+ { if def can contain nested types then handle its symtable }
+ case def.typ of
+ objectdef,recorddef:
+ gen_intf_wrappers(list,tabstractrecorddef(def).symtable,true);
+ procdef:
+ // check for local classes; currently, we only use them for closures
+ // TODO: this can slow codegen down dramatically?!
+ if assigned(tprocdef(def).localst) then
+ gen_intf_wrappers(list,tprocdef(def).localst,true);
+ end;
if is_class(def) then
gen_intf_wrapper(list,tobjectdef(def));
end;