AstNumLit* res = onyx_ast_node_new(a, sizeof(AstNumLit), Ast_Kind_NumLit);
res->token = node->token;
+ res->flags |= node->flags;
res->flags |= Ast_Flag_Comptime;
res->type_node = node->type_node;
res->type = node->type;
return Check_Error;
}
- sl->flags &= ((*actual)->flags & Ast_Flag_Comptime);
+ sl->flags &= ((*actual)->flags & Ast_Flag_Comptime) | (sl->flags &~ Ast_Flag_Comptime);
actual++;
}
bh_arr_each(AstTyped *, expr, al->values) {
CHECK(expression, expr);
- al->flags &= ((*expr)->flags & Ast_Flag_Comptime);
+ al->flags &= ((*expr)->flags & Ast_Flag_Comptime) | (al->flags &~ Ast_Flag_Comptime);
if (!type_check_or_auto_cast(expr, elem_type)) {
onyx_report_error((*expr)->token->pos, "Mismatched types for value of in array, expected '%s', got '%s'.",
bh_arr_each(AstTyped *, value, block->allocate_exprs) {
fill_in_type(*value);
- if ((*value)->type == NULL) {
- onyx_report_error((*value)->token->pos,
- "Unable to resolve type for local '%b'.",
- (*value)->token->text, (*value)->token->length);
- return Check_Error;
- }
- if ((*value)->type->kind == Type_Kind_Compound) {
- onyx_report_error((*value)->token->pos,
- "Compound type not allowed as local variable type. Try splitting this into multiple variables.");
- return Check_Error;
+ if ((*value)->kind == Ast_Kind_Local) {
+ if ((*value)->type == NULL) {
+ onyx_report_error((*value)->token->pos,
+ "Unable to resolve type for local '%b'.",
+ (*value)->token->text, (*value)->token->length);
+ return Check_Error;
+ }
+
+ if ((*value)->type->kind == Type_Kind_Compound) {
+ onyx_report_error((*value)->token->pos,
+ "Compound type not allowed as local variable type. Try splitting this into multiple variables.");
+ return Check_Error;
+ }
}
}
assert(0);
}
- if (expr->flags & Ast_Flag_Expr_Ignored && !type_results_in_void(expr->type)) {
+ if ((expr->flags & Ast_Flag_Expr_Ignored) != 0 && !type_results_in_void(expr->type)) {
i32 mem_count = 1;
if (type_is_compound(expr->type)) mem_count = type_linear_member_count(expr->type);
fori (i, 0, mem_count) WI(WI_DROP);