mirror of
https://github.com/wren-lang/wren.git
synced 2026-01-12 14:48:40 +01:00
- Rename IO.write -> IO.print. - Make IO.write not print a newline. - Support \u Unicode escapes in strings.
38 lines
550 B
Plaintext
38 lines
550 B
Plaintext
// This test exists mainly to make sure the GC traces instance fields.
|
|
class Node {
|
|
set(left, value, right) {
|
|
_left = left
|
|
_value = value
|
|
_right = right
|
|
}
|
|
|
|
write {
|
|
if (_left is Node) {
|
|
_left.write
|
|
}
|
|
|
|
IO.print(_value)
|
|
|
|
if (_right is Node) {
|
|
_right.write
|
|
}
|
|
}
|
|
}
|
|
|
|
var a = new Node
|
|
a.set(null, "a", null)
|
|
var b = new Node
|
|
b.set(null, "b", null)
|
|
var c = new Node
|
|
c.set(a, "c", b)
|
|
a = null
|
|
b = null
|
|
var d = new Node
|
|
d.set(c, "d", null)
|
|
c = null
|
|
d.write
|
|
// expect: a
|
|
// expect: c
|
|
// expect: b
|
|
// expect: d
|