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

Method parseArrowFunctionBody

parser/statement.go:278–299  ·  view source on GitHub ↗
(async bool)

Source from the content-addressed store, hash-verified

276}
277
278func (self *_parser) parseArrowFunctionBody(async bool) (ast.ConciseBody, []*ast.VariableDeclaration) {
279 if self.token == token.LEFT_BRACE {
280 return self.parseFunctionBlock(async, async, false)
281 }
282 if async != self.scope.inAsync || async != self.scope.allowAwait {
283 inAsync := self.scope.inAsync
284 allowAwait := self.scope.allowAwait
285 self.scope.inAsync = async
286 self.scope.allowAwait = async
287 allowYield := self.scope.allowYield
288 self.scope.allowYield = false
289 defer func() {
290 self.scope.inAsync = inAsync
291 self.scope.allowAwait = allowAwait
292 self.scope.allowYield = allowYield
293 }()
294 }
295
296 return &ast.ExpressionBody{
297 Expression: self.parseAssignmentExpression(),
298 }, nil
299}
300
301func (self *_parser) parseClass(declaration bool) *ast.ClassLiteral {
302 if declaration && !self.scope.allowLet && self.token == token.CLASS {

Callers 1

parseArrowFunctionMethod · 0.95

Calls 2

parseFunctionBlockMethod · 0.95

Tested by

no test coverage detected