-
Notifications
You must be signed in to change notification settings - Fork 148
ProcessClosures
Nathaniel Sabanski edited this page Jan 20, 2016
·
4 revisions
Added by dholton dholton
See the previous example from the ProcessMethodBodiesWithDuckTyping and ProcessSharedLocals steps.
Now a callable class is created for closures. More processing will occur in later steps.
import System.Windows.Forms from System.Windows.Forms
[Boo.Lang.ModuleAttribute]
public final transient class TempModule(System.Object):
private static def Main(argv as (System.String)) as System.Void:
___locals = TempModule.___locals3()
f = System.Windows.Forms.Form()
___locals.___clickcount_0 = 0
b = __eval__(
(___temp1 = System.Windows.Forms.Button()),
___temp1.set_Text('Hello'),
___temp1.set_Dock(System.Windows.Forms.DockStyle.Fill),
___temp1)
b.add_Click(TempModule.___closure2(___locals).Invoke)
f.get_Controls().Add(b)
f.ShowDialog()
private def constructor():
super()
class ___locals3(System.Object):
internal ___clickcount_0 as System.Int32
public def constructor():
super()
class ___closure2(System.Object):
internal _____locals4 as TempModule.___locals3
public def constructor(_____locals4 as TempModule.___locals3):
super()
self._____locals4 = _____locals4
public def Invoke() as System.Void:
Boo.Lang.Builtins.print("you clicked me ${(
self._____locals4.___clickcount_0 = (
self._____locals4.___clickcount_0 + 1)
)
} times")