Skip to content

Commit

Permalink
Add a test for an unusual situation that came up in another change
Browse files Browse the repository at this point in the history
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=145829648
  • Loading branch information
tbreisacher authored and blickly committed Jan 28, 2017
1 parent 27852fc commit ca2f0f2
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions test/com/google/javascript/jscomp/NormalizeTest.java
Expand Up @@ -172,6 +172,38 @@ public void testConstInGlobalHoistScope() {
"}"));
}

public void testVarReferencedInHoistedFunction() {
test(
LINE_JOINER.join(
"var f1 = function() {",
" var x;",
"};",
"",
"(function () {",
" {",
" var x = 0;",
" }",
" function f2() {",
" alert(x);",
" }",
" f2();",
"})();"),
LINE_JOINER.join(
"var f1 = function() {",
" var x;",
"};",
"",
"(function () {",
" function f2() {",
" alert(x$jscomp$1);",
" }",
" {",
" var x$jscomp$1 = 0;",
" }",
" f2();",
"})();"));
}

public void testAssignShorthand() {
test("x |= 1;", "x = x | 1;");
test("x ^= 1;", "x = x ^ 1;");
Expand Down

0 comments on commit ca2f0f2

Please sign in to comment.