Skip to content

Commit

Permalink
return void 0 instead of null in null propagating and null check call…
Browse files Browse the repository at this point in the history
… expressions
  • Loading branch information
alongubkin committed Nov 15, 2014
1 parent d72a2a8 commit 7f42076
Show file tree
Hide file tree
Showing 3 changed files with 104 additions and 94 deletions.
11 changes: 8 additions & 3 deletions lib/ast/expressions/NullCheckCallExpression.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,14 @@ exports.NullCheckCallExpression.prototype.codegen = function () {
this.test = test;
this.consequent = consequent;
this.alternate = {
"type": "Literal",
"value": null,
"raw": "null"
"type": "UnaryExpression",
"operator": "void",
"argument": {
"type": "Literal",
"value": 0,
"raw": "0"
},
"prefix": true
};
}
return this;
Expand Down
11 changes: 8 additions & 3 deletions lib/ast/expressions/NullPropagatingExpression.js
Original file line number Diff line number Diff line change
Expand Up @@ -149,9 +149,14 @@ exports.NullPropagatingExpression.prototype.codegen = function () {
"computed": false
},
"alternate": {
"type": "Literal",
"value": null,
"raw": "null"
"type": "UnaryExpression",
"operator": "void",
"argument": {
"type": "Literal",
"value": 0,
"raw": "0"
},
"prefix": true
},
"__null_propagating": true
};
Expand Down
Loading

0 comments on commit 7f42076

Please sign in to comment.