Reorganize trailing comma code a bit.
- Split out syntax error tests. - Avoid redundant handling of empty literals.
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
// Allow after '{', ':', and ',', and before ']'.
|
||||
var map = {
|
||||
|
||||
"a":
|
||||
|
||||
"a value",
|
||||
|
||||
"b": "b value"
|
||||
|
||||
}
|
||||
|
||||
IO.print(map["a"]) // expect: a value
|
||||
IO.print(map["b"]) // expect: b value
|
||||
|
||||
// Newline after trailing comma.
|
||||
map = {"c": "c value",
|
||||
|
||||
}
|
||||
|
||||
IO.print(map["c"]) // expect: c value
|
||||
|
||||
// Newline in empty map.
|
||||
map = {
|
||||
|
||||
}
|
||||
|
||||
IO.print(map.count) // expect: 0
|
||||
Reference in New Issue
Block a user