feat: add zero-arg IO.print overload and remove newline skipping in parameter parsing
Add a static `print` method with no arguments that writes only a newline, enabling blank-line output. Remove the `ignoreNewlines` calls before closing parentheses in parameter lists and method calls, tightening syntax rules. Add a `strlen` TODO comment in symbol table lookup for future optimization. Move the `Foo.toString` test from `test/io/write.wren` to `test/io/print.wren` and delete the old write test file.
This commit is contained in:
@@ -1,3 +1,10 @@
|
||||
class Foo {
|
||||
toString { "Foo.toString" }
|
||||
}
|
||||
|
||||
// Calls toString on argument.
|
||||
IO.print(new Foo) // expect: Foo.toString
|
||||
|
||||
// With one argument, returns the argument.
|
||||
IO.print(IO.print(1) == 1) // expect: 1
|
||||
// expect: true
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
class Foo {
|
||||
toString { "Foo.toString" }
|
||||
}
|
||||
|
||||
// Calls toString on argument.
|
||||
IO.print(new Foo) // expect: Foo.toString
|
||||
|
||||
// Returns argument.
|
||||
var result = IO.print(123) // expect: 123
|
||||
IO.print(result == 123) // expect: true
|
||||
|
||||
// TODO: What if toString on argument doesn't return a string?
|
||||
Reference in New Issue
Block a user