MCPcopy Create free account
hub / github.com/babel/babel / wrapParenthesis

Function wrapParenthesis

packages/babel-parser/src/parser/expression.ts:1908–1926  ·  view source on GitHub ↗
(startLoc: Position, expression: N.Expression)

Source from the content-addressed store, hash-verified

1906 }
1907
1908 wrapParenthesis(startLoc: Position, expression: N.Expression): N.Expression {
1909 if (!(this.optionFlags & OptionFlags.CreateParenthesizedExpressions)) {
1910 this.addExtra(expression, "parenthesized", true);
1911 this.addExtra(expression, "parenStart", startLoc.index);
1912
1913 this.takeSurroundingComments(
1914 expression,
1915 startLoc.index,
1916 this.state.lastTokEndLoc!.index,
1917 );
1918
1919 return expression;
1920 }
1921
1922 const parenExpression =
1923 this.startNodeAt<N.ParenthesizedExpression>(startLoc);
1924 parenExpression.expression = expression;
1925 return this.finishNode(parenExpression, "ParenthesizedExpression");
1926 }
1927
1928 // eslint-disable-next-line @typescript-eslint/no-unused-vars -- `params` is used in typescript plugin
1929 shouldParseArrow(params: N.Node[]): boolean {

Callers

nothing calls this directly

Calls 2

finishNodeMethod · 0.80

Tested by

no test coverage detected