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

Function wrapParenthesis

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

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 2

finishNodeMethod · 0.80

Tested by

no test coverage detected