Skip to content

Commit

Permalink
fixes #293
Browse files Browse the repository at this point in the history
  • Loading branch information
trullock committed Jan 14, 2022
1 parent cf24539 commit baf2180
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 1 deletion.
6 changes: 6 additions & 0 deletions src/NUglify.Tests/JavaScript/Bugs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -309,5 +309,11 @@ public void Bug285()
{
TestHelper.Instance.RunTest("-rename:all");
}

[Test]
public void Bug293()
{
TestHelper.Instance.RunTest("-rename:all");
}
}
}
6 changes: 6 additions & 0 deletions src/NUglify.Tests/NUglify.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -461,6 +461,9 @@
<Content Include="TestData\JS\Expected\BlockOpts\ReturnLiteral.js">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="TestData\JS\Expected\Bugs\Bug293.js">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="TestData\JS\Expected\Bugs\Bug253.js">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
Expand Down Expand Up @@ -2824,6 +2827,9 @@
<Content Include="TestData\JS\Input\Bugs\Bug138.js">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="TestData\JS\Input\Bugs\Bug293.js">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="TestData\JS\Input\Bugs\Bug284.js">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
Expand Down
1 change: 1 addition & 0 deletions src/NUglify.Tests/TestData/JS/Expected/Bugs/Bug293.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
async function myfunc(){return await myfunc()==="value"}
4 changes: 4 additions & 0 deletions src/NUglify.Tests/TestData/JS/Input/Bugs/Bug293.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
async function myfunc()
{
return await myfunc() === "value";
}
4 changes: 3 additions & 1 deletion src/NUglify/JavaScript/Syntax/UnaryExpression.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,11 @@ public override PrimitiveType FindPrimitiveType()

case JSToken.Void:
case JSToken.Delete:
case JSToken.RestSpread:
case JSToken.RestSpread:
case JSToken.Await:
// void returns undefined.
// delete returns number, but just return other
// await is a function call, and could return anything so its unknown
return PrimitiveType.Other;

default:
Expand Down

0 comments on commit baf2180

Please sign in to comment.