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:
Bob Nystrom
2014-04-19 18:44:51 +00:00
parent 15560a95f6
commit 29f4b8167c
6 changed files with 16 additions and 16 deletions
+7
View File
@@ -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
-12
View File
@@ -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?