mirror of
https://github.com/DarkPlacesEngine/gmqcc.git
synced 2025-03-23 11:11:22 +00:00
This should actually cover all nil cases
This commit is contained in:
parent
819ed10f29
commit
4d5153854b
2 changed files with 6 additions and 6 deletions
6
ast.c
6
ast.c
|
@ -204,6 +204,9 @@ ast_expression* ast_type_copy(lex_ctx ctx, const ast_expression *ex)
|
|||
|
||||
bool ast_compare_type(ast_expression *a, ast_expression *b)
|
||||
{
|
||||
if (a->expression.vtype == TYPE_NIL ||
|
||||
b->expression.vtype == TYPE_NIL)
|
||||
return true;
|
||||
if (a->expression.vtype != b->expression.vtype)
|
||||
return false;
|
||||
if (!a->expression.next != !b->expression.next)
|
||||
|
@ -909,8 +912,7 @@ bool ast_call_check_types(ast_call *self)
|
|||
count = vec_size(func->expression.params);
|
||||
|
||||
for (i = 0; i < count; ++i) {
|
||||
if (self->params[i]->expression.vtype != TYPE_NIL &&
|
||||
!ast_compare_type(self->params[i], (ast_expression*)(func->expression.params[i])))
|
||||
if (!ast_compare_type(self->params[i], (ast_expression*)(func->expression.params[i])))
|
||||
{
|
||||
char texp[1024];
|
||||
char tgot[1024];
|
||||
|
|
6
parser.c
6
parser.c
|
@ -1041,8 +1041,7 @@ static bool parser_sy_apply_operator(parser_t *parser, shunt *sy)
|
|||
}
|
||||
else
|
||||
assignop = type_storep_instr[exprs[0]->expression.vtype];
|
||||
if (assignop == AINSTR_END ||
|
||||
(exprs[1]->expression.vtype != TYPE_NIL && !ast_compare_type(field->expression.next, exprs[1])))
|
||||
if (assignop == AINSTR_END || !ast_compare_type(field->expression.next, exprs[1]))
|
||||
{
|
||||
ast_type_to_string(field->expression.next, ty1, sizeof(ty1));
|
||||
ast_type_to_string(exprs[1], ty2, sizeof(ty2));
|
||||
|
@ -1074,8 +1073,7 @@ static bool parser_sy_apply_operator(parser_t *parser, shunt *sy)
|
|||
ast_type_to_string(exprs[1], ty2, sizeof(ty2));
|
||||
parseerror(parser, "invalid types in assignment: cannot assign %s to %s", ty2, ty1);
|
||||
}
|
||||
else if (exprs[1]->expression.vtype != TYPE_NIL &&
|
||||
!ast_compare_type(exprs[0], exprs[1]))
|
||||
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));
|
||||
|
|
Loading…
Reference in a new issue