fix ability to use previous generic params and

add error when `%return` shows up in a function with incorrect
return type
This commit is contained in:
Andrew Kelley
2016-05-09 13:44:29 -07:00
parent 745c325d0f
commit f1e5be9686
6 changed files with 43 additions and 25 deletions

View File

@@ -2605,7 +2605,7 @@ static AstNode *ast_parse_use(ParseContext *pc, int *token_index,
/*
ContainerDecl = ("struct" | "enum" | "union") "Symbol" option(ParamDeclList) "{" many(StructMember) "}"
StructMember = many(Directive) option(VisibleMod) (StructField | FnDef | GlobalVarDecl)
StructMember = many(Directive) option(VisibleMod) (StructField | FnDef | GlobalVarDecl | ContainerDecl)
StructField : "Symbol" option(":" Expression) ",")
*/
static AstNode *ast_parse_container_decl(ParseContext *pc, int *token_index,
@@ -2675,6 +2675,12 @@ static AstNode *ast_parse_container_decl(ParseContext *pc, int *token_index,
continue;
}
AstNode *container_decl_node = ast_parse_container_decl(pc, token_index, directive_list, visib_mod);
if (container_decl_node) {
node->data.struct_decl.decls.append(container_decl_node);
continue;
}
Token *token = &pc->tokens->at(*token_index);
if (token->id == TokenIdRBrace) {