stage0 新增内存复制指令 重构vm交互
This commit is contained in:
1 parent
0b8f649818
commit
40cffa9cb5
22 files changed
+626
-158
No files matched your search
@@ -417,6 +417,20 @@ static spl_ast_node_ref_t parse_pattern_atom(spl_parser_t *p) {
|
||||
return ref;
|
||||
}
|
||||
|
||||
case TOK_AND: {
|
||||
/* `&name`:解包左值引用绑定。仅允许作用于绑定名。 */
|
||||
advance(p);
|
||||
const spl_tok_t *nx = peek(p);
|
||||
if (!nx || nx->type != TOK_IDENT) {
|
||||
PARSE_ERROR(p, SPL_DIAG_KIND_PARSE_EXPECTED, nx, "expected binding name after '&'");
|
||||
return 0;
|
||||
}
|
||||
spl_ast_node_ref_t inner = parse_pattern_atom(p);
|
||||
spl_ast_node_ref_t ref = new_node(p, SPL_AST_PATTERN_REF, t);
|
||||
node_at(p->ast, ref)->pattern_ref.pat = inner;
|
||||
return ref;
|
||||
}
|
||||
|
||||
default:
|
||||
PARSE_ERROR(p, SPL_DIAG_KIND_PARSE_UNRECOGNIZED, t, "unexpected token in pattern");
|
||||
return 0;
|
||||
|
||||
Reference in new issue
Block a user