]> git.xonotic.org Git - xonotic/gmqcc.git/commitdiff
renaming ast_function::vtype to function_type
authorWolfgang Bumiller <wry.git@bumiller.com>
Mon, 19 Jan 2015 12:37:22 +0000 (13:37 +0100)
committerWolfgang Bumiller <wry.git@bumiller.com>
Mon, 19 Jan 2015 12:37:22 +0000 (13:37 +0100)
ast.cpp
ast.h
parser.cpp

diff --git a/ast.cpp b/ast.cpp
index 4c1806df2c6f589e7fb8e23e055bd55a05205165..73f9b1288ae3ef55a2a83f92f728ecec64ae6bca 100644 (file)
--- a/ast.cpp
+++ b/ast.cpp
@@ -366,7 +366,7 @@ void ast_value_delete(ast_value* self)
             break;
         case TYPE_FUNCTION:
             /* unlink us from the function node */
-            self->constval.vfunc->vtype = nullptr;
+            self->constval.vfunc->function_type = nullptr;
             break;
         /* NOTE: delete function? currently collected in
          * the parser structure
@@ -1173,8 +1173,8 @@ ast_function* ast_function_new(lex_ctx_t ctx, const char *name, ast_value *vtype
         goto cleanup;
     }
 
-    self->vtype  = vtype;
-    self->name   = name ? util_strdup(name) : nullptr;
+    self->function_type = vtype;
+    self->name          = name ? util_strdup(name) : nullptr;
 
     self->labelcount = 0;
     self->builtin = 0;
@@ -1202,14 +1202,14 @@ void ast_function_delete(ast_function *self)
 {
     if (self->name)
         mem_d((void*)self->name);
-    if (self->vtype) {
-        /* ast_value_delete(self->vtype); */
-        self->vtype->hasvalue = false;
-        self->vtype->constval.vfunc = nullptr;
+    if (self->function_type) {
+        /* ast_value_delete(self->function_type); */
+        self->function_type->hasvalue = false;
+        self->function_type->constval.vfunc = nullptr;
         /* We use unref - if it was stored in a global table it is supposed
          * to be deleted from *there*
          */
-        ast_unref(self->vtype);
+        ast_unref(self->function_type);
     }
     for (auto &it : self->static_names)
         mem_d(it);
@@ -1781,7 +1781,7 @@ bool ast_function_codegen(ast_function *self, ir_builder *ir)
     }
 
     /* fill the parameter list */
-    ec = &self->vtype->expression;
+    ec = &self->function_type->expression;
     for (auto &it : ec->params) {
         if (it->expression.vtype == TYPE_FIELD)
             vec_push(irf->params, it->expression.next->vtype);
@@ -1854,8 +1854,8 @@ bool ast_function_codegen(ast_function *self, ir_builder *ir)
     /* TODO: check return types */
     if (!self->curblock->final)
     {
-        if (!self->vtype->expression.next ||
-            self->vtype->expression.next->vtype == TYPE_VOID)
+        if (!self->function_type->expression.next ||
+            self->function_type->expression.next->vtype == TYPE_VOID)
         {
             return ir_block_create_return(self->curblock, ast_ctx(self), nullptr);
         }
diff --git a/ast.h b/ast.h
index e721afc1b7a7501f088099b0a1df9a7b4e2970d6..dcfffbafeee7d5fad6b56db53c9b7947fdb18b48 100644 (file)
--- a/ast.h
+++ b/ast.h
@@ -624,7 +624,7 @@ struct ast_function
 {
     ast_node node;
 
-    ast_value *vtype;
+    ast_value  *function_type;
     const char *name;
 
     int builtin;
index fec3a22a5300537e343eb1f3d580665249038700..01067a159524a4ff05f8f0677d14595c05f226d5 100644 (file)
@@ -102,7 +102,7 @@ static ast_expression* parser_find_param(parser_t *parser, const char *name)
     ast_value *fun;
     if (!parser->function)
         return nullptr;
-    fun = parser->function->vtype;
+    fun = parser->function->function_type;
     for (auto &it : fun->expression.params) {
         if (!strcmp(it->name, name))
             return (ast_expression*)it;
@@ -1269,7 +1269,7 @@ static bool parser_close_call(parser_t *parser, shunt *sy)
     for (i = 0; i < paramcount; ++i)
         call->params.push_back(sy->out[fid+1 + i].out);
     sy->out.erase(sy->out.end() - paramcount, sy->out.end());
-    (void)!ast_call_check_types(call, parser->function->vtype->expression.varparam);
+    (void)!ast_call_check_types(call, parser->function->function_type->expression.varparam);
     if (parser->max_param_count < paramcount)
         parser->max_param_count = paramcount;
 
@@ -1405,7 +1405,7 @@ static ast_expression* parse_vararg_do(parser_t *parser)
 {
     ast_expression *idx, *out;
     ast_value      *typevar;
-    ast_value      *funtype = parser->function->vtype;
+    ast_value      *funtype = parser->function->function_type;
     lex_ctx_t         ctx     = parser_ctx(parser);
 
     if (!parser->function->varargs) {
@@ -2562,7 +2562,7 @@ static bool parse_return(parser_t *parser, ast_block *block, ast_expression **ou
     ast_expression *var      = nullptr;
     ast_return     *ret      = nullptr;
     ast_value      *retval   = parser->function->return_value;
-    ast_value      *expected = parser->function->vtype;
+    ast_value      *expected = parser->function->function_type;
 
     lex_ctx_t ctx = parser_ctx(parser);
 
@@ -6150,7 +6150,7 @@ static bool parser_set_coverage_func(parser_t *parser, ir_builder *ir) {
         return true;
     }
 
-    cov  = func->vtype;
+    cov  = func->function_type;
     expr = (ast_expression*)cov;
 
     if (expr->vtype != TYPE_FUNCTION || expr->params.size()) {
@@ -6226,8 +6226,8 @@ bool parser_finish(parser_t *parser, const char *output)
      */
     for (auto &f : parser->functions) {
         if (f->varargs) {
-            if (parser->max_param_count > f->vtype->expression.params.size()) {
-                f->varargs->expression.count = parser->max_param_count - f->vtype->expression.params.size();
+            if (parser->max_param_count > f->function_type->expression.params.size()) {
+                f->varargs->expression.count = parser->max_param_count - f->function_type->expression.params.size();
                 if (!parser_create_array_setter_impl(parser, f->varargs)) {
                     con_out("failed to generate vararg setter for %s\n", f->name);
                     ir_builder_delete(ir);