Skip to content

Commit

Permalink
Merge pull request #242 from trullock/bug_241
Browse files Browse the repository at this point in the history
Bug 241
  • Loading branch information
trullock authored Mar 15, 2021
2 parents a86b02a + a24d54c commit e3e6852
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 2 deletions.
4 changes: 4 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## vNext (unpublished)


## v1.13.8 (15 Mar 2021)
- Fixes bug with javascript use of "of" as an identifier

## v1.13.7 (15 Mar 2021)
- Fixes bug with javascript pretty-print formatting and empty object initializers {}

Expand Down
6 changes: 6 additions & 0 deletions src/NUglify.Tests/JavaScript/Bugs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -267,5 +267,11 @@ public void Bug216()
{
TestHelper.Instance.RunTest("-rename:all");
}

[Test]
public void Bug241()
{
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 @@ -423,6 +423,9 @@
<Content Include="TestData\JS\Expected\BlockOpts\ReturnLiteral.js">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="TestData\JS\Expected\Bugs\Bug241.js">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="TestData\JS\Expected\Bugs\Bug197.js">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
Expand Down Expand Up @@ -2756,6 +2759,9 @@
<Content Include="TestData\JS\Input\Bugs\Bug138.js">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="TestData\JS\Input\Bugs\Bug241.js">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="TestData\JS\Input\Bugs\Bug197.js">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
Expand Down
1 change: 1 addition & 0 deletions src/NUglify.Tests/TestData/JS/Expected/Bugs/Bug241.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
function foo(){return 1}function of(){return foo()}
9 changes: 9 additions & 0 deletions src/NUglify.Tests/TestData/JS/Input/Bugs/Bug241.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
function foo() {
var of = 1;

return of;
}

function of() {
return foo();
}
4 changes: 3 additions & 1 deletion src/NUglify/JavaScript/JSKeyword.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ internal static string CanBeIdentifier(JSToken keyword)
case JSToken.Get: return "get";
case JSToken.Set: return "set";
case JSToken.Super: return "super";
case JSToken.Of: return "of";

// what about EcmaScript 6? Does this become a reserved word?
case JSToken.Module: return "module";
Expand All @@ -77,7 +78,8 @@ internal static string CanBeIdentifier(JSToken keyword)

// apparently never allowed for Chrome, so we want to treat it
// differently, too
case JSToken.Native: return "native";
case JSToken.Native: return "native";


// no other tokens can be identifiers
default: return null;
Expand Down
2 changes: 1 addition & 1 deletion src/NUglify/NUglify.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<RepositoryType>git</RepositoryType>
<RepositoryUrl>git://github.com/trullock/NUglify</RepositoryUrl>
<NetStandardImplicitPackageVersion Condition=" '$(TargetFramework)' == 'netstandard1.3' ">1.6.0</NetStandardImplicitPackageVersion>
<Version>1.13.7</Version>
<Version>1.13.8</Version>
<PackageLicenseExpression></PackageLicenseExpression>
<LangVersion>latest</LangVersion>
</PropertyGroup>
Expand Down

0 comments on commit e3e6852

Please sign in to comment.