summaryrefslogtreecommitdiff
path: root/closures/compiler/symsym.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/symsym.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/symsym.pas')
-rw-r--r--closures/compiler/symsym.pas9
1 files changed, 9 insertions, 0 deletions
diff --git a/closures/compiler/symsym.pas b/closures/compiler/symsym.pas
index c91d3e5d80..653867552e 100644
--- a/closures/compiler/symsym.pas
+++ b/closures/compiler/symsym.pas
@@ -180,11 +180,14 @@ interface
defaultconstsymderef : tderef;
localloc : TLocation; { register/reference for local var }
initialloc : TLocation; { initial location so it can still be initialized later after the location was changed by SSA }
+ // if var is captured by a closure, this refers to a field of the class TCapturer
+ captured_into: tfieldvarsym;
constructor create(st:tsymtyp;const n : string;vsp:tvarspez;def:tdef;vopts:tvaroptions);
constructor ppuload(st:tsymtyp;ppufile:tcompilerppufile);
procedure ppuwrite(ppufile:tcompilerppufile);override;
procedure buildderef;override;
procedure deref;override;
+ function is_captured: boolean; inline;
end;
tlocalvarsym = class(tabstractnormalvarsym)
@@ -1397,6 +1400,12 @@ implementation
end;
+ function tabstractnormalvarsym.is_captured: boolean; inline;
+ begin
+ result:=assigned(captured_into)
+ end;
+
+
{****************************************************************************
Tstaticvarsym
****************************************************************************}