Describe the bug
When the transform panel uses Babel to parse with createParenthesizedExpressions: true and prints the AST to the console, there are no ParenthesizedExpression nodes in the console.
This doesn't match the tree view, which shows a ParenthesizedExpression node in between the ExpressionStatement and the StringLiteralExpression
This suggests the version of @babel/parser available in the transform panel is a different (older?) version than available in the tree view, such that the version in the transform panel doesn't support createParenthesizedExpressions
Expected behavior
The AST printed to the console to have a ParenthesizedExpression node in between the ExpressionStatement and the StringLiteralExpression nodes.
Screenshots
Browser (please complete the following information):
OS: MacOS
Browser Chrome
Version 102.0.5005.61
astexplorer settings:
Selected parser: @babel/parser with createParenthesizedExpressions: true and plugins jsx and typescript
Selected transformer recast
Contents of the local storage key explorerSettingsV1 (code can be removed if you don't want it to be public)
{"showTransformPanel":false,"parserSettings":{"babylon7":{"sourceType":"module","allowImportExportEverywhere":false,"allowReturnOutsideFunction":false,"createParenthesizedExpressions":false,"ranges":false,"tokens":true,"plugins":["typescript","jsx"],"pipelineOptions":{"proposal":"hack","hackTopicToken":"%"}},"esprima":null,"recast":null},"parserPerCategory":{"javascript":"babylon7"},"workbench":{"parser":"php-parser","code":"<?php\n\n$tips = [\n \"Click on any AST node with a '+' to expand it\",\n\n \"Hovering over a node highlights the \\\n corresponding location in the source code\",\n\n \"Shift click on an AST node to expand the whole subtree\"\n];\n\nfunction printTips() {\n global $tips;\n foreach($tips as $i => $tip) {\n echo \"Tip $i: \" . $tip;\n }\n}\n","keyMap":"default","transform":{"code":"\n\nexport default function transformer(code, { recast, parsers }) {\n\n const ast = recast.parse(code, {\n parser: {\n parse(source: string) {\n return parsers.babel.parse(source, {\n sourceType: 'module',\n // Note: Parens nodes don't make a difference\n createParenthesizedExpressions: true,\n });\n }\n }\n });\n console.log(ast);\n console.log(parsers);\n return recast.print(ast).code;\n}\n","transformer":"recast"}}}
Additional context
Add any other context about the problem here.
Describe the bug When the transform panel uses Babel to parse with
createParenthesizedExpressions: true
and prints the AST to the console, there are noParenthesizedExpression
nodes in the console.This doesn't match the tree view, which shows a
ParenthesizedExpression
node in between theExpressionStatement
and theStringLiteralExpression
This suggests the version of
@babel/parser
available in the transform panel is a different (older?) version than available in the tree view, such that the version in the transform panel doesn't supportcreateParenthesizedExpressions
To Reproduce https://astexplorer.net/#/gist/e7492c62c92b167cbc46e5a58dd28a47/9ad795d751343a625ca8683e0bf644eebbe4434a
Expected behavior The AST printed to the console to have a
ParenthesizedExpression
node in between theExpressionStatement
and theStringLiteralExpression
nodes.Screenshots
![Screen Shot 2022-06-08 at 12 01 31 AM](https://user-images.githubusercontent.com/364761/172528830-95ef35b3-2c83-4c51-9524-a4f04c679e47.png)
Browser (please complete the following information):
astexplorer settings:
@babel/parser
withcreateParenthesizedExpressions: true
and pluginsjsx
andtypescript
explorerSettingsV1
(code can be removed if you don't want it to be public)Additional context Add any other context about the problem here.