Add tasks for all the new languages
This commit is contained in:
parent
9dc3c2bb62
commit
bba7bfd280
13208 changed files with 134745 additions and 0 deletions
|
|
@ -0,0 +1,27 @@
|
|||
define exampletype => type {
|
||||
public foo() => {
|
||||
return 'this is foo\r'
|
||||
}
|
||||
public bar() => {
|
||||
return 'this is bar\r'
|
||||
}
|
||||
public _unknownTag(...) => {
|
||||
local(n = method_name->asString)
|
||||
return 'tried to handle unknown method called "'+#n+'"'+
|
||||
(#rest->size ? ' with args: "'+#rest->join(',')+'"')+'\r'
|
||||
}
|
||||
}
|
||||
|
||||
local(e = exampletype)
|
||||
|
||||
#e->foo()
|
||||
// outputs 'this is foo'
|
||||
|
||||
#e->bar()
|
||||
// outputs 'this is bar'
|
||||
|
||||
#e->stuff()
|
||||
// outputs 'tried to handle unknown method called "stuff"'
|
||||
|
||||
#e->dothis('here',12,'there','nowhere')
|
||||
// outputs 'tried to handle unknown method called "dothis" with args: "here,12,there,nowhere"'
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
1 first
|
||||
[1:interpreter] ExRuntime : 1 does not understand method <#first>
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
1 "first" asMethod perform
|
||||
[1:interpreter] ExRuntime : 1 does not understand method <#first>
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
1 "unknow_method" asMethod perform
|
||||
[1:interpreter] ExRuntime : null does not understand method <#perform>
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
Object Class new: MyClass
|
||||
MyClass method: doesNotUnderstand(m)
|
||||
"Well, sorry, I don't understand " print m println ;
|
||||
|
||||
MyClass new first
|
||||
Well, sorry, I don't understand #first
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
class Example {
|
||||
method foo {
|
||||
say "this is foo"
|
||||
}
|
||||
method bar {
|
||||
say "this is bar"
|
||||
}
|
||||
method AUTOLOAD(_, name, *args) {
|
||||
say ("tried to handle unknown method %s" % name);
|
||||
if (args.len > 0) {
|
||||
say ("it had arguments: %s" % args.join(', '));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var example = Example.new;
|
||||
|
||||
example.foo; # prints “this is foo”
|
||||
example.bar; # prints “this is bar”
|
||||
example.grill; # prints “tried to handle unknown method grill”
|
||||
example.ding("dong"); # prints “tried to handle unknown method ding”
|
||||
# prints “it had arguments: dong”
|
||||
Loading…
Add table
Add a link
Reference in a new issue