MCPcopy Create free account
hub / github.com/dop251/goja / parseFunctionParameterList

Method parseFunctionParameterList

parser/statement.go:166–195  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

164}
165
166func (self *_parser) parseFunctionParameterList() *ast.ParameterList {
167 opening := self.expect(token.LEFT_PARENTHESIS)
168 var list []*ast.Binding
169 var rest ast.Expression
170 if !self.scope.inFuncParams {
171 self.scope.inFuncParams = true
172 defer func() {
173 self.scope.inFuncParams = false
174 }()
175 }
176 for self.token != token.RIGHT_PARENTHESIS && self.token != token.EOF {
177 if self.token == token.ELLIPSIS {
178 self.next()
179 rest = self.reinterpretAsDestructBindingTarget(self.parseAssignmentExpression())
180 break
181 }
182 self.parseVariableDeclaration(&list)
183 if self.token != token.RIGHT_PARENTHESIS {
184 self.expect(token.COMMA)
185 }
186 }
187 closing := self.expect(token.RIGHT_PARENTHESIS)
188
189 return &ast.ParameterList{
190 Opening: opening,
191 List: list,
192 Rest: rest,
193 Closing: closing,
194 }
195}
196
197func (self *_parser) parseMaybeAsyncFunction(declaration bool) *ast.FunctionLiteral {
198 if self.peek() == token.FUNCTION {

Callers 3

parseMethodDefinitionMethod · 0.95
parseFunctionMethod · 0.95

Calls 5

expectMethod · 0.95
nextMethod · 0.95

Tested by

no test coverage detected