Return new instances of PYSON object from PYSON shortcut methods

Closes #12985
(grafted from af58504c1e6ad2b17cac5b6c41454d7eda28c5c7)

--HG--
branch : 6.0
This commit is contained in:
Cédric Krier committed 2024-02-03 19:29:59 +01:00
1 parent ba38dfa34f
commit 8eac7634e2
2 files changed
+6 -3

No files matched your search

+3 -3
View File
@@ -36,13 +36,13 @@
if (d === undefined) {
d = '';
}
return Sao.PYSON.Get(this, k, d);
return new Sao.PYSON.Get(this, k, d);
},
in_: function(obj) {
return Sao.PYSON.In(this, obj);
return new Sao.PYSON.In(this, obj);
},
contains: function(k) {
return Sao.PYSON.In(k, this);
return new Sao.PYSON.In(k, this);
},
toString: function() {
var klass = this.pyson().__class__;
+3
View File
@@ -1263,6 +1263,9 @@
QUnit.strictEqual(
eval_pyson('Or(True, False).toString()'),
"Or(true, false)", "eval_pyson('Or(True, False)').toString()");
QUnit.strictEqual(
eval_pyson('Eval("foo", {}).get("bar").toString()'),
'Get(Eval("foo", {}), "bar", "")');
});
QUnit.test('DomainParser.group_operator', function() {