var f; class Foo { method(param) { fun f_() { print param; } f = f_; } } Foo().method("param"); f(); // out: param