X-Git-Url: https://git.xonotic.org/?p=xonotic%2Fgmqcc.git;a=blobdiff_plain;f=parser.cpp;h=fcb782c7ab04a0ad1458844571c869fce595b3a8;hp=7845a86ed589ff328e57431abc05639bd65050b1;hb=6149f6a1d09e6c7d5c1c1e7de7e38635c791f697;hpb=9d98805dfb5ee245650c296e8f1ae935bd98dc06 diff --git a/parser.cpp b/parser.cpp index 7845a86..fcb782c 100644 --- a/parser.cpp +++ b/parser.cpp @@ -4376,7 +4376,7 @@ static ast_value* parser_create_array_setter_proto(parser_t *parser, ast_value * fval->m_next = (ast_expression*)ast_value_new(array->m_context, "", TYPE_VOID); index = ast_value_new(array->m_context, "index", TYPE_FLOAT); - value = ast_value_copy((ast_value*)array->m_next); + value = ast_value_from_type((ast_value*)array->m_next); if (!index || !value) { parseerror(parser, "failed to create locals for array accessor"); @@ -4442,7 +4442,7 @@ static bool parser_create_array_field_setter(parser_t *parser, ast_value *array, entity = ast_value_new(array->m_context, "entity", TYPE_ENTITY); index = ast_value_new(array->m_context, "index", TYPE_FLOAT); - value = ast_value_copy((ast_value*)array->m_next); + value = ast_value_from_type((ast_value*)array->m_next); if (!entity || !index || !value) { parseerror(parser, "failed to create locals for array accessor"); goto cleanup; @@ -4790,7 +4790,7 @@ static ast_value *parse_typename(parser_t *parser, ast_value **storebase, ast_va /* generate the basic type value */ if (cached_typedef) { - var = ast_value_copy(cached_typedef); + var = ast_value_from_type(cached_typedef); ast_value_set_name(var, ""); } else var = ast_value_new(ctx, "", parser_token(parser)->constval.t); @@ -4826,7 +4826,7 @@ static ast_value *parse_typename(parser_t *parser, ast_value **storebase, ast_va /* store the base if requested */ if (storebase) { - *storebase = ast_value_copy(var); + *storebase = ast_value_from_type(var); if (isfield) { tmp = ast_value_new(ctx, "", TYPE_FIELD); tmp->m_next = (ast_expression*)*storebase; @@ -5795,7 +5795,7 @@ another: parseerror(parser, "expected another variable"); break; } - var = ast_value_copy(basetype); + var = ast_value_from_type(basetype); cleanvar = true; ast_value_set_name(var, parser_tokval(parser)); if (!parser_next(parser)) {