stage1 重新实现ast2ir
This commit is contained in:
1 parent
bcd26d3021
commit
ab6e99c958
10 files changed
+1175
-677
No files matched your search
+3
-6
@@ -1452,9 +1452,10 @@ static spl_ast_node_ref_t parse_primary(parser_t *p) {
|
||||
return 0;
|
||||
}
|
||||
advance(p); // 消费 ']'
|
||||
spl_ast_node_ref_t ref = new_node(p, SPL_AST_EXPR_ANON_ARRAY_LIT, t);
|
||||
spl_ast_node_ref_t ref = new_node(p, SPL_AST_EXPR_ARRAY_LIT, t);
|
||||
spl_ast_node_t *arr = node_at(p->ast, ref);
|
||||
arr->anon_array_literal.elems = elems;
|
||||
arr->array_literal.elems = elems;
|
||||
arr->array_literal.elem_type = 0;
|
||||
return ref;
|
||||
} else {
|
||||
SPL_FATAL(nx, "expected '{' or '[' after '.'");
|
||||
@@ -2463,10 +2464,6 @@ static void dump_node(spl_ast_t *ast, spl_ast_node_ref_t node_ref, dump_stack_t
|
||||
dump_vec(ast, node->array_literal.elems, stack);
|
||||
break;
|
||||
|
||||
case SPL_AST_EXPR_ANON_ARRAY_LIT:
|
||||
dump_vec(ast, node->anon_array_literal.elems, stack);
|
||||
break;
|
||||
|
||||
case SPL_AST_EXPR_AGGREGATE_LIT:
|
||||
|
||||
dump_vec(ast, node->aggregate_literal.fields, stack);
|
||||
|
||||
Reference in new issue
Block a user