don't try to access function-local functions outside of functions...

This commit is contained in:
Wolfgang (Blub) Bumiller 2012-08-16 11:36:16 +02:00
parent dd995a8ee2
commit 470fc68b06

View file

@ -226,6 +226,8 @@ ast_expression* parser_find_local(parser_t *parser, const char *name, size_t upt
if (!strcmp(parser->locals[i].name, name)) if (!strcmp(parser->locals[i].name, name))
return parser->locals[i].var; return parser->locals[i].var;
} }
if (!parser->function)
return NULL;
fun = parser->function->vtype; fun = parser->function->vtype;
for (i = 0; i < fun->expression.params_count; ++i) { for (i = 0; i < fun->expression.params_count; ++i) {
if (!strcmp(fun->expression.params[i]->name, name)) if (!strcmp(fun->expression.params[i]->name, name))