mirror of
https://github.com/wren-lang/wren.git
synced 2026-01-12 22:58:40 +01:00
This allows "%(...)" inside a string literal to interpolate the stringified result of an expression. It doesn't support custom interpolators or format strings, but we can consider extending that later.
41 lines
681 B
Plaintext
41 lines
681 B
Plaintext
class A {
|
|
construct new(arg) {
|
|
System.print("new A %(arg)")
|
|
_field = arg
|
|
}
|
|
|
|
aField { _field }
|
|
}
|
|
|
|
class B is A {
|
|
construct new(arg1, arg2) {
|
|
super(arg2)
|
|
System.print("new B %(arg1)")
|
|
_field = arg1
|
|
}
|
|
|
|
bField { _field }
|
|
}
|
|
|
|
class C is B {
|
|
construct new() {
|
|
super("one", "two")
|
|
System.print("new C")
|
|
_field = "c"
|
|
}
|
|
|
|
cField { _field }
|
|
}
|
|
|
|
var c = C.new()
|
|
// expect: new A two
|
|
// expect: new B one
|
|
// expect: new C
|
|
System.print(c is A) // expect: true
|
|
System.print(c is B) // expect: true
|
|
System.print(c is C) // expect: true
|
|
|
|
System.print(c.aField) // expect: two
|
|
System.print(c.bField) // expect: one
|
|
System.print(c.cField) // expect: c
|