()
| 992 | } |
| 993 | |
| 994 | public FunctionExpression functionExpression() { |
| 995 | try { |
| 996 | pushContext(ContextType.FUNCTION); |
| 997 | Token position = consume(FUNCTION); |
| 998 | Token identifier = null; |
| 999 | String identifierName = null; |
| 1000 | if (la() == IDENTIFIER) { |
| 1001 | identifier = consume(IDENTIFIER); |
| 1002 | if (!isAssignableName(identifier.getText())) { |
| 1003 | throw new SyntaxError(identifier, "invalid identifier: " + identifier.getText()); |
| 1004 | } |
| 1005 | identifierName = identifier.getText(); |
| 1006 | } |
| 1007 | |
| 1008 | List<Parameter> params = formalParameters(); |
| 1009 | |
| 1010 | consume(LEFT_BRACE); |
| 1011 | BlockStatement body = functionBody(); |
| 1012 | consume(RIGHT_BRACE); |
| 1013 | |
| 1014 | return factory.functionExpression(position, identifierName, params, body, currentContext().isStrict()); |
| 1015 | } finally { |
| 1016 | popContext(); |
| 1017 | } |
| 1018 | } |
| 1019 | |
| 1020 | public FunctionDeclaration functionDeclaration() { |
| 1021 | try { |
no test coverage detected