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

Method parseSingleArgArrowFunction

parser/expression.go:1204–1232  ·  view source on GitHub ↗
(start file.Idx, async bool)

Source from the content-addressed store, hash-verified

1202}
1203
1204func (self *_parser) parseSingleArgArrowFunction(start file.Idx, async bool) ast.Expression {
1205 if async != self.scope.allowAwait {
1206 self.scope.allowAwait = async
1207 defer func() {
1208 self.scope.allowAwait = !async
1209 }()
1210 }
1211 self.tokenToBindingId()
1212 if self.token != token.IDENTIFIER {
1213 self.errorUnexpectedToken(self.token)
1214 self.next()
1215 return &ast.BadExpression{
1216 From: start,
1217 To: self.idx,
1218 }
1219 }
1220
1221 id := self.parseIdentifier()
1222
1223 paramList := &ast.ParameterList{
1224 Opening: id.Idx,
1225 Closing: id.Idx1(),
1226 List: []*ast.Binding{{
1227 Target: id,
1228 }},
1229 }
1230
1231 return self.parseArrowFunction(start, paramList, async)
1232}
1233
1234func (self *_parser) parseAssignmentExpression() ast.Expression {
1235 start := self.idx

Callers 1

Calls 6

tokenToBindingIdMethod · 0.95
errorUnexpectedTokenMethod · 0.95
nextMethod · 0.95
parseIdentifierMethod · 0.95
parseArrowFunctionMethod · 0.95
Idx1Method · 0.65

Tested by

no test coverage detected