parser: Move function scope check to parse_func()
Signed-off-by: Ian Moffett <ian@mirocom.org>
This commit is contained in:
@@ -431,6 +431,11 @@ parse_func(struct rifle_state *state, struct token *tok, struct ast_node **res)
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (state->cur_func != NULL) {
|
||||
trace_error(state, "nested functions not supported\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Is this marked as public? */
|
||||
if ((prevtok = tokbuf_lookbehind(&state->tokbuf, 1)) != NULL) {
|
||||
if (prevtok->type == TT_PUB)
|
||||
@@ -550,11 +555,6 @@ parse_begin(struct rifle_state *state)
|
||||
while (parse_scan(state, &tok) == 0) {
|
||||
switch (tok.type) {
|
||||
case TT_F:
|
||||
if (state->cur_func != NULL) {
|
||||
trace_error(state, "nested functions not supported\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (parse_func(state, &tok, &root) < 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user