Commit c6cef2f9 authored by Guillaume Charifi's avatar Guillaume Charifi

compiler/parser: Allow ".new" to be a val_var_sub.

parent 64f9ce56
......@@ -257,20 +257,31 @@ static int parse_val_var_sub(struct parser_ctx *ctx, unsigned long *cur_tok_id,
return -1;
i++;
if (ctx->in->tokens[i].type != BM_TOK_IDENTIFIER)
return -1;
result = parse_var_name(ctx->in->tokens[i].data.as_wstr);
if (result < 0)
return -1;
parser_node_init(&val, BM_AST_NODE_VAL_VAR_SUB);
val.dtor = val_var_sub_dtor;
val.data.as_val_var_sub.name = str_dup(ctx->in->tokens[i].data.as_wstr);
if (!val.data.as_val_var_sub.name)
if (ctx->in->tokens[i].type == BM_TOK_IDENTIFIER)
{
result = parse_var_name(ctx->in->tokens[i].data.as_wstr);
if (result < 0)
goto failed;
val.data.as_val_var_sub.name = str_dup(ctx->in->tokens[i].data.as_wstr);
if (!val.data.as_val_var_sub.name)
goto failed;
i++;
}
else if (ctx->in->tokens[i].type == BM_TOK_NEW)
{
val.data.as_val_var_sub.name = str_dup(L"new");
if (!val.data.as_val_var_sub.name)
goto failed;
i++;
}
else
{
goto failed;
i++;
}
parser_node_set_child(&val, BM_AST_NODE_VAL_VAR_SUB_CHILD_EXPR, left_expr);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment