Skip to content

Commit

Permalink
Add optional function call to optional chaining (compat-table#1585)
Browse files Browse the repository at this point in the history
  • Loading branch information
ilogico committed Feb 17, 2020
1 parent a47e3ac commit 6dc6b45
Show file tree
Hide file tree
Showing 2 changed files with 244 additions and 107 deletions.
27 changes: 26 additions & 1 deletion data-es2016plus.js
Expand Up @@ -3874,7 +3874,7 @@ exports.tests = [
{
name: 'optional method call',
exec: function(){/*
var foo = { baz: function () { return 42; } };
var foo = { baz: function () { return this.value; }, value: 42 };
var bar = null;
return foo?.baz() === 42 && bar?.baz() === undefined;
*/},
Expand All @@ -3894,6 +3894,31 @@ exports.tests = [
graalvm: false,
}
},
{
name: 'optional function call',
exec: function(){/*
var foo = { baz: function () { return 42; } };
var bar = {};
function baz() { return 42; };
var n;
return foo.baz?.() === 42 && bar.baz?.() === undefined && baz?.() === 42 && n?.() === undefined;
*/},
res : {
babel7corejs2: true,
typescript3_7corejs3: true,
ie11: false,
firefox10: false,
firefox52: false,
firefox73: false,
firefox74: true,
chrome77: false,
chrome78: {val: 'flagged', note_id: "chrome-optional-chaining"},
chrome80: true,
safari13_1: true,
safaritp: true,
graalvm: false,
}
},
]
},
{
Expand Down

0 comments on commit 6dc6b45

Please sign in to comment.