basic/source/comp/loops.cxx |   13 +------------
 1 file changed, 1 insertion(+), 12 deletions(-)

New commits:
commit 076e2ffc1b1836d778309314d745dea5da5988d4
Author:     Mike Kaganski <mike.kagan...@collabora.com>
AuthorDate: Sun Oct 6 16:44:13 2024 +0500
Commit:     Xisco Fauli <xiscofa...@libreoffice.org>
CommitDate: Tue Oct 8 10:22:16 2024 +0200

    Simplify assignment of Nothing
    
    In commits f3f46b5fe729876d128f63f7ab158954ab6657d7 (tdf#132064: make
    With statement only evaluate its argument once, 2024-04-18) and
    40d0e6f4c4ca31f6525b4c84924f2330a166182c (tdf#162962: always create a
    local "Nothing" for the "WITH" variable, 2024-09-16), I used hacks to
    emulate the global Nothing.
    
    This change implements it properly, I think, It makes sure to use the
    RTL's Nothing; this saves compile-time checks, strings in pool, and
    makes code cleaner.
    
    Change-Id: I3d007c5aa187e9aa61c1c369511be969b8cf57f4
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/174553
    Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com>
    Tested-by: Jenkins
    (cherry picked from commit fe40a5ca030f72e31ce1b33d32b6b500131a2039)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/174452
    Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org>

diff --git a/basic/source/comp/loops.cxx b/basic/source/comp/loops.cxx
index eb75df882d13..997e2a9db23c 100644
--- a/basic/source/comp/loops.cxx
+++ b/basic/source/comp/loops.cxx
@@ -325,19 +325,8 @@ void SbiParser::With()
     CloseBlock();
 
     // {_with_library.module_offset} = Nothing
-    // I don't know how to refer to the global Nothing constant here; just 
create an own
-    OUString aLocalNothingName = u"{_with_Nothing}"_ustr;
-    while (pPool->Find(aLocalNothingName) != nullptr)
-    {
-        static sal_Int64 unique_suffix_2;
-        aLocalNothingName = "{_with_Nothing" + 
OUString::number(unique_suffix_2++) + "}";
-    }
-    SbiSymDef* pNothingDef = new SbiSymDef(aLocalNothingName);
-    pNothingDef->SetType(SbxOBJECT);
-    pPool->Add(pNothingDef);
-    aGen.Gen(SbiOpcode::LOCAL_, pNothingDef->GetId(), pNothingDef->GetType());
     aWithParent.Gen();
-    SbiExpression(this, *pNothingDef).Gen();
+    aGen.Gen(SbiOpcode::RTL_, aGblStrings.Add(u"Nothing"_ustr), SbxOBJECT);
     aGen.Gen(SbiOpcode::PUTC_);
 }
 

Reply via email to