mirror of
https://github.com/wren-lang/wren.git
synced 2026-01-12 06:38:45 +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.
22 lines
357 B
Plaintext
22 lines
357 B
Plaintext
class Foo {
|
|
construct new() {}
|
|
method(a, b) { "method %(a) %(b)" }
|
|
[a, b] { "subscript %(a) %(b)" }
|
|
}
|
|
|
|
var foo = Foo.new()
|
|
|
|
// Allow newlines after commas and before ")".
|
|
System.print(foo.method("a",
|
|
|
|
"b"
|
|
|
|
)) // expect: method a b
|
|
|
|
// Allow newlines after commas and before "]".
|
|
System.print(foo["a",
|
|
|
|
"b"
|
|
|
|
]) // expect: subscript a b
|