forked from Mirror/wren
Blocks, functions, and methods now have the same code for handling their bodies. This means that single-line methods work like single-line functions: they return the result of their expression.
18 lines
418 B
Plaintext
18 lines
418 B
Plaintext
// Handle empty list.
|
|
IO.print([].toString) // expect: []
|
|
|
|
// Does not quote strings.
|
|
IO.print([1, "2", true].toString) // expect: [1, 2, true]
|
|
|
|
// Nested lists.
|
|
IO.print([1, [2, [3], 4], 5]) // expect: [1, [2, [3], 4], 5]
|
|
|
|
// Calls toString on elements.
|
|
class Foo {
|
|
toString { "Foo.toString" }
|
|
}
|
|
|
|
IO.print([1, new Foo, 2]) // expect: [1, Foo.toString, 2]
|
|
|
|
// TODO: Handle lists that contain themselves.
|