mirror of
https://github.com/DarkPlacesEngine/gmqcc.git
synced 2024-11-30 15:41:12 +00:00
Support for aliases to aliases too.
This commit is contained in:
parent
060bc0be10
commit
6fc141733f
1 changed files with 12 additions and 3 deletions
15
parser.c
15
parser.c
|
@ -5275,9 +5275,18 @@ static bool parse_variable(parser_t *parser, ast_block *localblock, bool nofield
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
ast_expression *find = parser_find_var(parser, var->desc);
|
void *entry = (void*)var->desc;
|
||||||
|
ast_expression *find = parser_find_var(parser, var->desc);
|
||||||
|
|
||||||
|
/* aliases to aliases are also allowed */
|
||||||
if (!find) {
|
if (!find) {
|
||||||
compile_error(parser_ctx(parser), "undeclared variable `%s` for alias `%s", var->desc, var->name);
|
char *name = NULL;
|
||||||
|
if ((find = parser_find_var(parser, (const char *)(name = util_htget(parser->aliases, var->desc)))))
|
||||||
|
entry = (void*)name;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!find) {
|
||||||
|
compile_error(parser_ctx(parser), "undeclared variable `%s` for alias `%s`", var->desc, var->name);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5294,7 +5303,7 @@ static bool parse_variable(parser_t *parser, ast_block *localblock, bool nofield
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
util_htset(parser->aliases, var->name, (void*)var->desc);
|
util_htset(parser->aliases, var->name, entry);
|
||||||
/*
|
/*
|
||||||
* TODO: vector, find . or _ (last of), and build
|
* TODO: vector, find . or _ (last of), and build
|
||||||
* [._]x, [._]y, [._]z aliases too.
|
* [._]x, [._]y, [._]z aliases too.
|
||||||
|
|
Loading…
Reference in a new issue