ast_expression *exprs[3];
ast_block *blocks[3];
ast_value *asvalue[3];
+ ast_binstore *asbinstore;
size_t i, assignop, addop, subop;
qcint generated_op = 0;
if (exprs[1]->expression.vtype != exprs[2]->expression.vtype) {
ast_type_to_string(exprs[1], ty1, sizeof(ty1));
ast_type_to_string(exprs[2], ty2, sizeof(ty2));
- parseerror(parser, "iperands of ternary expression must have the same type, got %s and %s", ty1, ty2);
+ parseerror(parser, "operands of ternary expression must have the same type, got %s and %s", ty1, ty2);
return false;
}
if (CanConstFold1(exprs[0]))
else if (!ast_compare_type(exprs[0], exprs[1])) {
ast_type_to_string(exprs[0], ty1, sizeof(ty1));
ast_type_to_string(exprs[1], ty2, sizeof(ty2));
- if (opts_standard == COMPILER_QCC &&
+ if (OPTS_FLAG(ASSIGN_FUNCTION_TYPES) &&
exprs[0]->expression.vtype == TYPE_FUNCTION &&
exprs[1]->expression.vtype == TYPE_FUNCTION)
{
if (ast_istype(exprs[0], ast_value) && asvalue[0]->constant) {
parseerror(parser, "assignment to constant `%s`", asvalue[0]->name);
}
- out = (ast_expression*)ast_binstore_new(ctx, assignop, INSTR_SUB_F, exprs[0], out);
+ asbinstore = ast_binstore_new(ctx, assignop, INSTR_SUB_F, exprs[0], out);
+ asbinstore->keep_dest = true;
+ out = (ast_expression*)asbinstore;
break;
}
#undef NotSameType
lex_ctx ctx = parser_ctx(parser);
(void)block; /* not touching */
+ (void)opval;
/* parse over the opening paren */
if (!parser_next(parser) || parser->tok != '(') {
retval = false;
goto cleanup;
}
+ proto = (ast_value*)old;
+ if (!ast_istype(old, ast_value)) {
+ parseerror(parser, "internal error: not an ast_value");
+ retval = false;
+ proto = NULL;
+ goto cleanup;
+ }
+ ast_delete(var);
+ var = proto;
}
}
if (opts_standard == COMPILER_QCC &&