()
| 1018 | } |
| 1019 | |
| 1020 | public FunctionDeclaration functionDeclaration() { |
| 1021 | try { |
| 1022 | pushContext(ContextType.FUNCTION); |
| 1023 | Token position = consume(FUNCTION); |
| 1024 | Token identifier = consume(IDENTIFIER); |
| 1025 | if (!isAssignableName(identifier.getText())) { |
| 1026 | throw new SyntaxError(identifier, "invalid identifier: " + identifier.getText()); |
| 1027 | } |
| 1028 | |
| 1029 | List<Parameter> params = formalParameters(); |
| 1030 | |
| 1031 | consume(LEFT_BRACE); |
| 1032 | BlockStatement body = functionBody(); |
| 1033 | consume(RIGHT_BRACE); |
| 1034 | |
| 1035 | return factory.functionDeclaration(position, identifier.getText(), params, body, currentContext().isStrict()); |
| 1036 | } finally { |
| 1037 | popContext(); |
| 1038 | } |
| 1039 | } |
| 1040 | |
| 1041 | public FunctionDescriptor functionDescriptor() { |
| 1042 | try { |
no test coverage detected