forked from facebookarchive/libfbjs
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix the buggy code dealing with nested if's
Summary: Old code only deals with if () { if () } else {} but does not handle following case properly if () { for () { if () } } else {} This patch has a quick fix that always put braces around TRUE statements if there is an else part. Reviewed By: rdbayer Test Plan: The code triggers this bug is in html/js/lib/ui/sort.js See the reduced test case, and tested on my sandbox, it works fine. Revert: OK DiffCamp Revision: 70592
- Loading branch information
Feng Qian
committed
Oct 23, 2009
1 parent
42ba4fb
commit f2579af
Showing
3 changed files
with
38 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
function foo(a, b) { | ||
if (a) { | ||
if (b) { | ||
print('b'); | ||
} | ||
} else { | ||
print('a'); | ||
} | ||
} | ||
|
||
foo(true, false); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
function foo(a, b) { | ||
if (a) { | ||
for (var i = 0; i < 1; i++) { | ||
if (!a) | ||
break; | ||
else if (b) | ||
print('hello'); | ||
} | ||
} else { | ||
print('ok'); | ||
} | ||
} | ||
|
||
foo(true, false); |