Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes issue with async arrow function without parameters #89

Merged
merged 1 commit into from
Mar 11, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
const object = {
doSomething: (test) => {
regularFunction: (test) => {
return "done" + test;
},
doSomethingAsync: async (url) => {
asyncArrowFunctionWithoutParameters: async () => {
return await fetch("someurl");
},
asyncArrowFunctionWithParameters: async (url) => {
return await fetch(url);
}
}
Expand Down
6 changes: 4 additions & 2 deletions src/NUglify/JavaScript/JSParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3967,6 +3967,7 @@ private AstNode ParseLeftHandSideExpression(bool isMinus)
case JSToken.LeftParenthesis:
{
var leftParen = m_currentToken.Clone();
var parentAst = ast;
GetNextToken();
if (m_currentToken.Is(JSToken.For))
{
Expand Down Expand Up @@ -4035,8 +4036,7 @@ private AstNode ParseLeftHandSideExpression(bool isMinus)
{
ast = new GroupingOperator(leftParen)
{
Operand = operand,
Parent = ast
Operand = operand
};
ast.UpdateWith(operand.Context);

Expand All @@ -4052,6 +4052,8 @@ private AstNode ParseLeftHandSideExpression(bool isMinus)
}
}
}

ast.Parent = parentAst;
}
}
break;
Expand Down