From 6be0df6001e9f7ab70bba8ac29652af71ff453bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Sun, 30 Jan 2022 13:10:57 +0100 Subject: [PATCH] Use simplified parser for get_eval_fields Instead of using the PYSONEncoder we can just iterate over the basic JSON types and use the pyson method to retrieve nested PYSON instances. issue11164 review376551002 --- src/pyson.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/pyson.js b/src/pyson.js index d5308789a4..c5e48ed561 100644 --- a/src/pyson.js +++ b/src/pyson.js @@ -168,7 +168,18 @@ }, __string_params__: function() { return [this._value, this._default]; - } + }, + get basename() { + var name = this._value; + if (name.startsWith('_parent_')) { + name = name.slice('_parent_'.length); + } + var idx = name.indexOf('.'); + if (idx >= 0) { + name = name.substring(0, idx); + } + return name; + }, }); Sao.PYSON.Eval.eval_ = function(value, context) {