feat: generate records from compile-time collections
This commit is contained in:
+11
-2
@@ -1428,7 +1428,7 @@ parse_call proc(state @mut State, callee ast.NodeId, start u32, builtin bool) as
|
||||
defer state.allow_record_literals = previous
|
||||
state.paren_depth += 1
|
||||
defer state.paren_depth -= 1
|
||||
skip_operand_newlines(state)
|
||||
skip_argument_newlines(state)
|
||||
arguments arraylist.ArrayList(ast.NodeId) := arraylist.init(state.allocator)
|
||||
defer arraylist.deinit(&arguments)
|
||||
argument_start :: state.next_token
|
||||
@@ -1441,7 +1441,7 @@ parse_call proc(state @mut State, callee ast.NodeId, start u32, builtin bool) as
|
||||
try arraylist.append(&arguments, argument)
|
||||
if (!next_is(state, .comma)) break
|
||||
state.next_token += 1
|
||||
skip_operand_newlines(state)
|
||||
skip_argument_newlines(state)
|
||||
}
|
||||
if (!previous and !next_is(state, .close_paren)) {
|
||||
# a guard's body may look like a record argument until its missing ')' is known.
|
||||
@@ -1744,6 +1744,15 @@ skip_operand_newlines proc(state @mut State) void {
|
||||
) state.next_token = start
|
||||
}
|
||||
|
||||
@hide:file
|
||||
skip_argument_newlines proc(state @mut State) void {
|
||||
skip_operand_newlines(state)
|
||||
if (!next_is(state, .newline)) return
|
||||
start :: state.next_token
|
||||
skip_newlines(state)
|
||||
if (!next_is(state, .open_curly)) state.next_token = start
|
||||
}
|
||||
|
||||
@hide:file
|
||||
skip_continuation_newlines proc(state @mut State) void {
|
||||
if (state.paren_depth == 0 or !next_is(state, .newline)) return
|
||||
|
||||
Reference in New Issue
Block a user