mirror of
https://github.com/wren-lang/wren.git
synced 2026-01-16 20:28:04 +01:00
"IO" -> "System".
Get rid of the separate opt-in IO class and replace it with a core System class. - Remove wren_io.c, wren_io.h, and io.wren. - Remove the flags that disable it. - Remove the overloads for print() with different arity. (It was an experiment, but I don't think it's that useful.) - Remove IO.read(). That will reappear using libuv in the CLI at some point. - Remove IO.time. Doesn't seem to have been used. - Update all of the tests, docs, etc. I'm sorry for all the breakage this causes, but I think "System" is a better name for this class (it makes it natural to add things like "System.gc()") and frees up "IO" for referring to the CLI's IO module.
This commit is contained in:
@ -1,2 +1,2 @@
|
||||
var a
|
||||
IO.print(a) // expect: null
|
||||
System.print(a) // expect: null
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
{
|
||||
var a = a + 1 // expect error
|
||||
IO.print(a)
|
||||
System.print(a)
|
||||
}
|
||||
|
||||
@ -3,13 +3,13 @@ class Foo {
|
||||
|
||||
bar {
|
||||
var a = "a"
|
||||
IO.print(a) // expect: a
|
||||
System.print(a) // expect: a
|
||||
var b = a + " b"
|
||||
IO.print(b) // expect: a b
|
||||
System.print(b) // expect: a b
|
||||
var c = a + " c"
|
||||
IO.print(c) // expect: a c
|
||||
System.print(c) // expect: a c
|
||||
var d = b + " d"
|
||||
IO.print(d) // expect: a b d
|
||||
System.print(d) // expect: a b d
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
var a = "outer"
|
||||
{
|
||||
IO.print(a) // expect: outer
|
||||
System.print(a) // expect: outer
|
||||
}
|
||||
}
|
||||
@ -1,4 +1,4 @@
|
||||
{
|
||||
var a
|
||||
IO.print(a) // expect: null
|
||||
System.print(a) // expect: null
|
||||
}
|
||||
|
||||
@ -255,5 +255,5 @@
|
||||
var a253 = a252
|
||||
var a254 = a253
|
||||
var a255 = a254
|
||||
IO.print(a255) // expect: value
|
||||
System.print(a255) // expect: value
|
||||
}
|
||||
|
||||
@ -259,7 +259,7 @@
|
||||
var a253 = a252
|
||||
var a254 = a253
|
||||
var a255 = a254
|
||||
IO.print(a255) // expect: value a
|
||||
System.print(a255) // expect: value a
|
||||
}
|
||||
|
||||
{
|
||||
@ -519,6 +519,6 @@
|
||||
var b253 = b252
|
||||
var b254 = b253
|
||||
var b255 = b254
|
||||
IO.print(b255) // expect: value b
|
||||
System.print(b255) // expect: value b
|
||||
}
|
||||
}
|
||||
|
||||
@ -6,13 +6,13 @@ class Foo {
|
||||
foo { "method" }
|
||||
|
||||
method {
|
||||
IO.print(foo)
|
||||
System.print(foo)
|
||||
}
|
||||
|
||||
static foo { "class method" }
|
||||
|
||||
static classMethod {
|
||||
IO.print(foo)
|
||||
System.print(foo)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -3,11 +3,11 @@ var a = "out"
|
||||
if (true) {
|
||||
var a = "in"
|
||||
}
|
||||
IO.print(a) // expect: out
|
||||
System.print(a) // expect: out
|
||||
|
||||
// Create a local scope for the 'else' expression.
|
||||
var b = "out"
|
||||
if (false) "dummy" else {
|
||||
var b = "in"
|
||||
}
|
||||
IO.print(b) // expect: out
|
||||
System.print(b) // expect: out
|
||||
|
||||
@ -1,9 +1,9 @@
|
||||
{
|
||||
var a = "first"
|
||||
IO.print(a) // expect: first
|
||||
System.print(a) // expect: first
|
||||
}
|
||||
|
||||
{
|
||||
var a = "second"
|
||||
IO.print(a) // expect: second
|
||||
System.print(a) // expect: second
|
||||
}
|
||||
|
||||
@ -4,4 +4,4 @@ var i = 0
|
||||
while ((i = i + 1) <= 1) {
|
||||
var a = "inner"
|
||||
}
|
||||
IO.print(a) // expect: outer
|
||||
System.print(a) // expect: outer
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
{
|
||||
var a = "outer"
|
||||
{
|
||||
IO.print(a) // expect: outer
|
||||
System.print(a) // expect: outer
|
||||
var a = "inner"
|
||||
IO.print(a) // expect: inner
|
||||
System.print(a) // expect: inner
|
||||
}
|
||||
}
|
||||
@ -1,6 +1,6 @@
|
||||
var a = "global"
|
||||
{
|
||||
var a = "shadow"
|
||||
IO.print(a) // expect: shadow
|
||||
System.print(a) // expect: shadow
|
||||
}
|
||||
IO.print(a) // expect: global
|
||||
System.print(a) // expect: global
|
||||
@ -2,6 +2,6 @@
|
||||
var a = "outer"
|
||||
{
|
||||
var a = a + " inner"
|
||||
IO.print(a) // expect: outer inner
|
||||
System.print(a) // expect: outer inner
|
||||
}
|
||||
}
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
var a = "local"
|
||||
{
|
||||
var a = "shadow"
|
||||
IO.print(a) // expect: shadow
|
||||
System.print(a) // expect: shadow
|
||||
}
|
||||
IO.print(a) // expect: local
|
||||
System.print(a) // expect: local
|
||||
}
|
||||
@ -1 +1 @@
|
||||
IO.print(notDefined) // expect error
|
||||
System.print(notDefined) // expect error
|
||||
|
||||
@ -1,3 +1,3 @@
|
||||
Fn.new {
|
||||
IO.print(notDefined) // expect error
|
||||
System.print(notDefined) // expect error
|
||||
}.call()
|
||||
|
||||
Reference in New Issue
Block a user