mirror of
https://github.com/DarkPlacesEngine/gmqcc.git
synced 2025-02-21 10:51:10 +00:00
ast_block_set_type
This commit is contained in:
parent
1f8ece7f20
commit
ab11808208
2 changed files with 14 additions and 0 deletions
13
ast.c
13
ast.c
|
@ -420,6 +420,19 @@ void ast_block_delete(ast_block *self)
|
||||||
mem_d(self);
|
mem_d(self);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool ast_block_set_type(ast_block *self, ast_expression *from)
|
||||||
|
{
|
||||||
|
if (self->expression.next)
|
||||||
|
ast_delete(self->expression.next);
|
||||||
|
self->expression.vtype = from->expression.vtype;
|
||||||
|
if (from->expression.next) {
|
||||||
|
self->expression.next = ast_type_copy(self->expression.node.context, from->expression.next);
|
||||||
|
if (!self->expression.next)
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
ast_function* ast_function_new(lex_ctx ctx, const char *name, ast_value *vtype)
|
ast_function* ast_function_new(lex_ctx ctx, const char *name, ast_value *vtype)
|
||||||
{
|
{
|
||||||
ast_instantiate(ast_function, ctx, ast_function_delete);
|
ast_instantiate(ast_function, ctx, ast_function_delete);
|
||||||
|
|
1
ast.h
1
ast.h
|
@ -359,6 +359,7 @@ struct ast_block_s
|
||||||
};
|
};
|
||||||
ast_block* ast_block_new(lex_ctx ctx);
|
ast_block* ast_block_new(lex_ctx ctx);
|
||||||
void ast_block_delete(ast_block*);
|
void ast_block_delete(ast_block*);
|
||||||
|
bool ast_block_set_type(ast_block*, ast_expression *from);
|
||||||
|
|
||||||
MEM_VECTOR_PROTO(ast_block, ast_value*, locals);
|
MEM_VECTOR_PROTO(ast_block, ast_value*, locals);
|
||||||
MEM_VECTOR_PROTO(ast_block, ast_expression*, exprs);
|
MEM_VECTOR_PROTO(ast_block, ast_expression*, exprs);
|
||||||
|
|
Loading…
Reference in a new issue