aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/scheme/scheme.cpp
diff options
context:
space:
mode:
authorsobols <sobols@yandex-team.com>2022-10-12 19:31:35 +0300
committersobols <sobols@yandex-team.com>2022-10-12 19:31:35 +0300
commit918fcce7e3028401867b3276871686c4add87705 (patch)
treeeac49fbdbaebb83d97e0beb84ddc098396cd6a69 /library/cpp/scheme/scheme.cpp
parentee2715d277e3d307e86d4987a14abfb9986fab55 (diff)
downloadydb-918fcce7e3028401867b3276871686c4add87705.tar.gz
[scheme] Allow to create a new null value which shares a pool with the current value without directly attaching it as child
Diffstat (limited to 'library/cpp/scheme/scheme.cpp')
-rw-r--r--library/cpp/scheme/scheme.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/library/cpp/scheme/scheme.cpp b/library/cpp/scheme/scheme.cpp
index e6b59e8346..5ef2e80c8c 100644
--- a/library/cpp/scheme/scheme.cpp
+++ b/library/cpp/scheme/scheme.cpp
@@ -68,6 +68,10 @@ namespace NSc {
return TValue().CopyFrom(*this);
}
+ TValue TValue::CreateNew() const {
+ return Y_LIKELY(TheCore) ? TValue(TheCore->Pool) : TValue();
+ }
+
double TValue::ForceNumber(double deflt) const {
const TScCore& core = Core();
if (core.IsNumber()) {
@@ -231,7 +235,7 @@ namespace NSc {
}
bool TValue::SamePool(const TValue& a, const TValue& b) {
- return Same(a, b) || a.TheCore->Pool.Get() == b.TheCore->Pool.Get();
+ return Same(a, b) || (a.TheCore && b.TheCore && a.TheCore->Pool.Get() == b.TheCore->Pool.Get());
}
bool TValue::Equal(const TValue& a, const TValue& b) {