Skip to content
Fetching contributors…
Cannot retrieve contributors at this time
38 lines (28 sloc) 620 Bytes
#!./parrot nqp.pbc
plan(5);
class Foo {
has $!abc;
method foo() { $!abc := 1 };
method uno() {
self.foo();
};
method des() {
if 1 {
self.foo();
}
};
method tres($a) {
if 1 {
self.foo();
}
};
method quat() {
for 2,3 -> $a {
ok($a + $!abc, 'Can access attribute within lexical block');
}
}
};
ok(Foo.new.uno, "Can access self within method");
ok(Foo.new.des, "Can access self within sub-block");
ok(Foo.new.tres(42), "Can access self within method with signature");
Foo.new.quat;
Jump to Line
Something went wrong with that request. Please try again.