X-Git-Url: http://de.git.xonotic.org/?p=xonotic%2Fgmqcc.git;a=blobdiff_plain;f=ast.cpp;h=57a7cc217e081f90c28296e7098713cb13031e73;hp=8b74467cd2101e073565941e6d1974464292e94b;hb=4de08db0e7b73a832d638acc03c6936395fd2095;hpb=67a3c9b0310b915baace7a81cce1d8faa3994f20 diff --git a/ast.cpp b/ast.cpp index 8b74467..57a7cc2 100644 --- a/ast.cpp +++ b/ast.cpp @@ -978,7 +978,6 @@ ast_call* ast_call_new(lex_ctx_t ctx, ast_side_effects(self) = true; - self->params = NULL; self->func = funcexpr; self->va_count = NULL; @@ -989,10 +988,8 @@ ast_call* ast_call_new(lex_ctx_t ctx, void ast_call_delete(ast_call *self) { - size_t i; - for (i = 0; i < vec_size(self->params); ++i) - ast_unref(self->params[i]); - vec_free(self->params); + for (auto &it : self->params) + ast_unref(it); if (self->func) ast_unref(self->func); @@ -1054,7 +1051,7 @@ bool ast_call_check_types(ast_call *self, ast_expression *va_type) size_t i; bool retval = true; const ast_expression *func = self->func; - size_t count = vec_size(self->params); + size_t count = self->params.size(); if (count > func->params.size()) count = func->params.size(); @@ -1078,7 +1075,7 @@ bool ast_call_check_types(ast_call *self, ast_expression *va_type) retval = false; } } - count = vec_size(self->params); + count = self->params.size(); if (count > func->params.size() && func->varparam) { for (; i < count; ++i) { if (ast_istype(self->params[i], ast_argpipe)) { @@ -3389,13 +3386,10 @@ bool ast_call_codegen(ast_call *self, ast_function *func, bool lvalue, ir_value params = NULL; /* parameters */ - for (i = 0; i < vec_size(self->params); ++i) - { + for (auto &it : self->params) { ir_value *param; - ast_expression *expr = self->params[i]; - - cgen = expr->codegen; - if (!(*cgen)(expr, func, false, ¶m)) + cgen = it->codegen; + if (!(*cgen)(it, func, false, ¶m)) goto error; if (!param) goto error;