This repository has been archived by the owner on Feb 12, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 422
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Expand x==null using a disjunction (#2572)
Summary: Fixes #2563, #2564 Pull Request resolved: #2572 Differential Revision: D10027955 Pulled By: sb98052 fbshipit-source-id: 4023e3c32362cb95f477d4d990dd9b8edb5a963c
- Loading branch information
1 parent
7f3b5d4
commit 9681e2e
Showing
4 changed files
with
38 additions
and
7 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,5 @@ | ||
let x = global.__abstract ? __abstract(undefined, "undefined") : undefined; | ||
|
||
if (x == null) global.result = x === null; | ||
|
||
inspect = () => global.result; |
7 changes: 7 additions & 0 deletions
7
test/serializer/optimizations/simplifyCompNullOrUndefined2.js
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,7 @@ | ||
// does contain result = false | ||
|
||
let x = global.__abstract ? __abstract(undefined, "undefined") : undefined; | ||
|
||
if (x != null) global.result = x === undefined; | ||
|
||
inspect = () => global.result; |
8 changes: 8 additions & 0 deletions
8
test/serializer/optimizations/simplifyCompNullOrUndefined3.js
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,8 @@ | ||
function f(obj) { | ||
let y = obj.foo; | ||
if (y == null) { | ||
return y === undefined; | ||
} | ||
} | ||
global.__optimize && __optimize(f); | ||
inspect = () => f({ foo: null }); |