Add lexer support for `TOKEN_INTERPOLATION` to split string literals at interpolation points, introduce `MAX_INTERPOLATION_NESTING` limit of 8, and compile interpolated strings by emitting calls to `String.interpolate_()`. Optimize list and map literal construction with new `addCore_` primitives to reduce stack churn. Update `String`, `List`, and `Map` `toString` methods in core library to use interpolation syntax, and migrate all benchmark and test files from explicit concatenation to interpolated strings.
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
|