Reorganize trailing comma code a bit.

- Split out syntax error tests.
- Avoid redundant handling of empty literals.
This commit is contained in:
Bob Nystrom
2015-08-31 07:23:36 -07:00
parent d7eed08774
commit 2b044666ee
12 changed files with 82 additions and 51 deletions
+1 -9
View File
@@ -1,12 +1,4 @@
var list = [
"a",
"b",
]
var list = ["a", "b",]
IO.print(list[0]) // expect: a
IO.print(list[1]) // expect: b
// Invalid syntax
IO.print(new Fiber { Meta.eval("[,]") }.try()) // expect: Could not compile source code.
IO.print(new Fiber { Meta.eval("[1,,]") }.try()) // expect: Could not compile source code.
IO.print(new Fiber { Meta.eval("[1,,2]") }.try()) // expect: Could not compile source code.