(
this: Parser,
refExpressionErrors?: ExpressionErrors | null,
isParenItem?: boolean,
)
| 287 | refExpressionErrors?: ExpressionErrors | null, |
| 288 | ): N.Expression; |
| 289 | parseMaybeAssign( |
| 290 | this: Parser, |
| 291 | refExpressionErrors?: ExpressionErrors | null, |
| 292 | isParenItem?: boolean, |
| 293 | ): N.Expression | N.TSTypeCastExpression { |
| 294 | const startLoc = this.state.startLoc; |
| 295 | const isYield = this.isContextual(tt._yield); |
| 296 | if (isYield) { |
| 297 | if (this.prodParam.hasYield) { |
| 298 | this.next(); |
| 299 | let left: N.Expression | N.TSTypeCastExpression = |
| 300 | this.parseYield(startLoc); |
| 301 | if (isParenItem) { |
| 302 | left = this.parseParenItem(left, startLoc); |
| 303 | } |
| 304 | return left; |
| 305 | } |
| 306 | } |
| 307 | |
| 308 | let ownExpressionErrors; |
| 309 | let inInitializerScope = false; |
| 310 | if (refExpressionErrors) { |
| 311 | ownExpressionErrors = false; |
| 312 | } else { |
| 313 | refExpressionErrors = new ExpressionErrors(); |
| 314 | ownExpressionErrors = true; |
| 315 | // Without refExpressionErrors, this expression is not part of a cover |
| 316 | // grammar and can never be a binding target. |
| 317 | if (this.expressionScope.canBeInParameters()) { |
| 318 | this.expressionScope.enter(initializerScope); |
| 319 | inInitializerScope = true; |
| 320 | } |
| 321 | } |
| 322 | |
| 323 | this.state.canStartArrow = true; |
| 324 | let left: N.Expression | N.TSTypeCastExpression = |
| 325 | this.parseMaybeConditional(refExpressionErrors); |
| 326 | if (isParenItem) { |
| 327 | left = this.parseParenItem(left, startLoc); |
| 328 | } |
| 329 | if ( |
| 330 | tokenIsAssignment(this.state.type) && |
| 331 | // `/=` can't continue an expression ending with an arrow function body |
| 332 | // or an argument-less `yield`: it starts a regular expression literal, |
| 333 | // which is re-tokenized by the next statement after ASI. |
| 334 | !( |
| 335 | this.match(tt.slashAssign) && |
| 336 | this.state.lastTokEndLoc!.index === this.state.regExpAllowedAt |
| 337 | ) |
| 338 | ) { |
| 339 | const node = this.startNodeAt<N.AssignmentExpression>(startLoc); |
| 340 | const operator = this.state.value as N.AssignmentExpression["operator"]; |
| 341 | node.operator = operator; |
| 342 | |
| 343 | if (this.match(tt.eq)) { |
| 344 | this.toAssignable(left, /* isLHS */ true); |
| 345 | node.left = left; |
| 346 |
nothing calls this directly
no test coverage detected