func (P *Parser) ParseFunctionType() *AST.FunctionType {
P.Trace("FunctionType");
- P.OpenScope();
- P.level--;
-
typ := new(AST.FunctionType);
typ.pos = P.pos;
typ.params = P.ParseParameters();
typ.result = P.ParseResult();
-
- P.level++;
- P.CloseScope();
P.Ecart();
return typ;
P.Expect(keyword);
if P.tok == Scanner.LPAREN {
P.Next();
+ decl.decls.Add(P.ParseSpec(exported, keyword));
+ P.OptSemicolon(Scanner.RPAREN);
for P.tok != Scanner.RPAREN {
decl.decls.Add(P.ParseSpec(exported, keyword));
P.OptSemicolon(Scanner.RPAREN);
}
for P.tok == Scanner.IDENT {
ident := P.ParseIdent();
- P.Optional(Scanner.COMMA); // TODO this seems wrong
+ if P.tok == Scanner.COMMA {
+ P.Next(); // TODO this seems wrong
+ }
}
if has_paren {
P.Expect(Scanner.RPAREN)