moo/kernel/test-008.moo

63 lines
915 B
Smalltalk
Raw Permalink Normal View History

2016-03-28 13:27:03 +00:00
2017-01-09 12:52:37 +00:00
#include 'Moo.moo'.
2016-03-28 13:27:03 +00:00
////////////////////////////////////////////////////////////////#
// MAIN
////////////////////////////////////////////////////////////////#
2016-03-28 13:27:03 +00:00
// TODO: use #define to define a class or use #class to define a class.
// use #extend to extend a class
// using #class for both feels confusing.
2016-03-28 13:27:03 +00:00
extend Apex
2016-03-28 13:27:03 +00:00
{
}
extend SmallInteger
2016-03-28 13:27:03 +00:00
{
method getTrue: anInteger
2016-03-28 13:27:03 +00:00
{
^anInteger + 9999.
}
method inc
2016-03-28 13:27:03 +00:00
{
^self + 1.
}
}
class TestObject(Object)
2016-03-28 13:27:03 +00:00
{
var(#class) Q, R.
var(#classinst) a1, a2.
2016-03-28 13:27:03 +00:00
}
class MyObject(TestObject)
2016-03-28 13:27:03 +00:00
{
var(#classinst) t1, t2, t3.
method(#class) xxxx
2016-03-28 13:27:03 +00:00
{
| g1 g2 |
t1 dump.
2016-06-20 15:42:51 +00:00
t3 value.
2016-03-28 13:27:03 +00:00
t2 := [ g1 := 50. g2 := 100. ^g1 + g2 ].
(t1 < 10) ifFalse: [ ^self ].
t1 := t1 + 1.
^self xxxx.
}
method(#class) main
2016-03-28 13:27:03 +00:00
{
2016-06-20 15:42:51 +00:00
t3 := ['1111' dump. ^20.].
2016-03-28 13:27:03 +00:00
t1 := 1.
self xxxx.
'END OF XXX' dump.
t2 := t2 value.
'END OF t2 value' dump.
t2 dump.
}
}