feat: replace IO class with System class and remove separate IO module
- Delete wren_io.c, wren_io.h, and io.wren source files - Remove multi-arity print overloads and IO.read/IO.time methods - Add System class with print, printAll, write, writeAll methods to core.wren - Update all documentation examples and README to use System.print instead of IO.print
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
class Foo {
|
||||
this +(value) { // expect error
|
||||
IO.print("ok")
|
||||
System.print("ok")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
class Foo {
|
||||
this -(value) { // expect error
|
||||
IO.print("ok")
|
||||
System.print("ok")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
class Foo {
|
||||
this name=(value) { // expect error
|
||||
IO.print("ok")
|
||||
System.print("ok")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
class Foo {
|
||||
this [value] { // expect error
|
||||
IO.print("ok")
|
||||
System.print("ok")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
class Foo {
|
||||
this ! { // expect error
|
||||
IO.print("ok")
|
||||
System.print("ok")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
class Foo {
|
||||
construct new() {
|
||||
IO.print("ok")
|
||||
System.print("ok")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -5,10 +5,10 @@ class Foo {
|
||||
toString { _field }
|
||||
}
|
||||
|
||||
IO.print(Foo.named()) // expect: named
|
||||
IO.print(Foo.other()) // expect: other
|
||||
System.print(Foo.named()) // expect: named
|
||||
System.print(Foo.other()) // expect: other
|
||||
|
||||
// Returns the new instance.
|
||||
var foo = Foo.named()
|
||||
IO.print(foo is Foo) // expect: true
|
||||
IO.print(foo.toString) // expect: named
|
||||
System.print(foo is Foo) // expect: true
|
||||
System.print(foo.toString) // expect: named
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
class Foo {
|
||||
this new { // expect error
|
||||
IO.print("ok")
|
||||
System.print("ok")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
class A {
|
||||
construct new(arg) {
|
||||
IO.print("new A ", arg)
|
||||
System.print("new A " + arg)
|
||||
_field = arg
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ class A {
|
||||
class B is A {
|
||||
construct new(arg1, arg2) {
|
||||
super(arg2)
|
||||
IO.print("new B ", arg1)
|
||||
System.print("new B " + arg1)
|
||||
_field = arg1
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ class B is A {
|
||||
class C is B {
|
||||
construct new() {
|
||||
super("one", "two")
|
||||
IO.print("new C")
|
||||
System.print("new C")
|
||||
_field = "c"
|
||||
}
|
||||
|
||||
@@ -31,10 +31,10 @@ var c = C.new()
|
||||
// expect: new A two
|
||||
// expect: new B one
|
||||
// expect: new C
|
||||
IO.print(c is A) // expect: true
|
||||
IO.print(c is B) // expect: true
|
||||
IO.print(c is C) // expect: true
|
||||
System.print(c is A) // expect: true
|
||||
System.print(c is B) // expect: true
|
||||
System.print(c is C) // expect: true
|
||||
|
||||
IO.print(c.aField) // expect: two
|
||||
IO.print(c.bField) // expect: one
|
||||
IO.print(c.cField) // expect: c
|
||||
System.print(c.aField) // expect: two
|
||||
System.print(c.bField) // expect: one
|
||||
System.print(c.cField) // expect: c
|
||||
|
||||
Reference in New Issue
Block a user