| 1 |
class Say: |
| 2 |
var prefix = "S" |
| 3 |
|
| 4 |
func greet(): |
| 5 |
prefix = "S Greeted" |
| 6 |
print("hello") |
| 7 |
|
| 8 |
func say(name): |
| 9 |
print(prefix, " say something ", name) |
| 10 |
|
| 11 |
|
| 12 |
class SayAnotherThing extends Say: |
| 13 |
# This currently crashes the engine. |
| 14 |
#var prefix = "SAT" |
| 15 |
|
| 16 |
func greet(): |
| 17 |
prefix = "SAT Greeted" |
| 18 |
print("hi") |
| 19 |
|
| 20 |
func say(name): |
| 21 |
print(prefix, " say another thing ", name) |
| 22 |
|
| 23 |
|
| 24 |
class SayNothing extends Say: |
| 25 |
# This currently crashes the engine. |
| 26 |
#var prefix = "SN" |
| 27 |
|
| 28 |
func greet(): |
| 29 |
super() |
| 30 |
prefix = "SN Greeted" |
| 31 |
print("howdy, see above") |
| 32 |
|
| 33 |
func greet_prefix_before_super(): |
| 34 |
prefix = "SN Greeted" |
| 35 |
super.greet() |
| 36 |
print("howdy, see above") |
| 37 |
|
| 38 |
func say(name): |
| 39 |
@warning_ignore("unsafe_call_argument") |
| 40 |
super(name + " super'd") |
| 41 |
print(prefix, " say nothing... or not? ", name) |
| 42 |
|
| 43 |
|
| 44 |
func test(): |
| 45 |
var say = Say.new() |
| 46 |
say.greet() |
| 47 |
say.say("foo") |
| 48 |
print() |
| 49 |
|
| 50 |
var say_another_thing = SayAnotherThing.new() |
| 51 |
say_another_thing.greet() |
| 52 |
say_another_thing.say("bar") |
| 53 |
print() |
| 54 |
|
| 55 |
var say_nothing = SayNothing.new() |
| 56 |
say_nothing.greet() |
| 57 |
print(say_nothing.prefix) |
| 58 |
say_nothing.greet_prefix_before_super() |
| 59 |
print(say_nothing.prefix) |
| 60 |
# This currently triggers a compiler bug: "compiler bug, function name not found" |
| 61 |
#say_nothing.say("baz") |