mirror of
https://github.com/krgamestudios/Toy.git
synced 2026-04-15 23:04:08 +10:00
Added dot chaining for functions
Well, it should work without issues...
This commit is contained in:
22
scripts/test/dot-chaining.toy
Normal file
22
scripts/test/dot-chaining.toy
Normal file
@@ -0,0 +1,22 @@
|
||||
//test function chaining with the dot operator
|
||||
|
||||
fn _identity(self) {
|
||||
return self;
|
||||
}
|
||||
|
||||
fn _check(self) {
|
||||
assert self == 42, "dot chaining failed";
|
||||
return self;
|
||||
}
|
||||
|
||||
var val = 42;
|
||||
|
||||
val
|
||||
.identity()
|
||||
.check()
|
||||
.identity()
|
||||
.check()
|
||||
;
|
||||
|
||||
|
||||
print "All good";
|
||||
Reference in New Issue
Block a user