1
0
mirror of https://github.com/robertkrimen/otto synced 2025-10-26 20:28:49 +08:00

Added FunctionStatement

This commit is contained in:
wolfgarnet
2016-02-09 20:49:50 +01:00
parent 53221230c2
commit 3b2178bf55
3 changed files with 19 additions and 3 deletions

View File

@@ -79,9 +79,7 @@ func (self *_parser) parseStatement() ast.Statement {
case token.VAR:
return self.parseVariableStatement()
case token.FUNCTION:
self.parseFunction(true)
// FIXME
return &ast.EmptyStatement{}
return self.parseFunctionStatement()
case token.SWITCH:
return self.parseSwitchStatement()
case token.RETURN:
@@ -231,6 +229,14 @@ func (self *_parser) parseParameterList() (list []string) {
return
}
func (self *_parser) parseFunctionStatement() *ast.FunctionStatement {
function := &ast.FunctionStatement{
Function: self.parseFunction(true),
}
return function
}
func (self *_parser) parseFunction(declaration bool) *ast.FunctionLiteral {
node := &ast.FunctionLiteral{