Return default value when evaluating undefined value

issue11089
review374511002
(grafted from 21cc9ddb278906609bbdee15aaa17d03422476e6)

--HG--
branch : 6.0
This commit is contained in:
Cédric Krier committed 2022-01-03 22:49:47 +01:00
1 parent be5604b539
commit fbf2e4bfb1
2 files changed
+4 -1

No files matched your search

+1 -1
View File
@@ -179,7 +179,7 @@
'd': value.d,
}, context[value.v.substring(0, idx)] || {});
}
if (value.v in context) {
if ((value.v in context) && (context[value.v] !== undefined)) {
return context[value.v];
} else {
return value.d;
+3
View File
@@ -102,6 +102,9 @@
"decode(Eval('test', 0))");
QUnit.strictEqual(new Sao.PYSON.Decoder().decode(eval_), 0,
"decode(Eval('test', 0))");
QUnit.strictEqual(
new Sao.PYSON.Decoder({test: undefined}).decode(eval_), 0,
"decode(Eval('test', 0))");
});
QUnit.test('PYSON Not', function() {