Changeset a6ea59f in tol


Ignore:
Timestamp:
Feb 16, 2010, 5:44:42 PM (17 years ago)
Author:
Víctor de Buen <vdebuen@…>
Branches:
1941-docker-image-to-test, devel, master
Children:
2cab927
Parents:
11d460a
Message:

Fixed #872
Destroying temporary objects in EvMember with syntax "... (...) ::"

git-svn-id: ​https://www.tol-project.org/svn/tolp/trunk@2034 be4846ae-f051-483a-831f-b64e7d08527f

File:
1 edited

Legend:

Unmodified
Added
Removed
  • tol/btol/bgrammar/spfuninst.cpp

    r11d460a ra6ea59f  
    15531553        BOperator* opr   = GetOperator(uCode);
    15541554        result = opr->Evaluate(branch2->cdr());
     1555        DESTROY(opr);
    15551556      }
    15561557    }
    … …  
    15591560      BStruct* str = (BStruct*)result;
    15601561      result = str->Function()->Evaluate(branch2->cdr());
     1562      DESTROY(str);
    15611563    }
    15621564    if((tt==TYPE)&&(result->Mode()==BCLASSMODE))
    … …  
    15731575        errMsg = I2("It was expected an instance of Class ",
    15741576                 "Se esperaba una instancia de Class ") +cls->Name();
     1577        DESTROY(result);
    15751578        result=NULL;
    15761579      }
     1580      DESTROY(cls);
    15771581    }
    15781582  }
    … …  
    15921596  static BText _name_ = "::";
    15931597  BSyntaxObject* result = NIL;
     1598  int stackPos = BGrammar::StackSize();
    15941599  BInt nb = BSpecialFunction::NumBranches(tre);
    15951600  BText errMsg;
     1601  BSyntaxObject* uns = NULL;
     1602  bool needsDeleteUns = false;
    15961603  if(BSpecialFunction::TestNumArg(_name_, 2, nb, 2))
    15971604  {
    … …  
    16101617/* */
    16111618    bool oldEnabled = BOut::Disable();
    1612     BSyntaxObject* uns = GraNameBlock()->LeftEvaluateTree(branch1);
     1619    int nObjOld = BSyntaxObject::NSyntaxObject();
     1620    uns = GraNameBlock()->LeftEvaluateTree(branch1);
    16131621    if(!uns) { uns = GraSet()->LeftEvaluateTree(branch1); }
    16141622    if(!uns)
    … …  
    16301638      }
    16311639    }
     1640    int nObjNew = BSyntaxObject::NSyntaxObject();
     1641    needsDeleteUns = (uns!=NULL) && (nObjNew>nObjOld);
    16321642    if(oldEnabled) { BOut::Enable(); }
    16331643    BToken* arg2 = BParser::treToken(branch2);
    … …  
    16391649        BClass* cls = (BClass*)uns;
    16401650        result = cls->FindStatic(memberName,false);
    1641         result = EvMemberArg
     1651        BSyntaxObject* r = EvMemberArg
    16421652         (_name_, gra, branch2, arg2, memberName,cls->Name(), errMsg, result);
     1653        DESTROY(result);
     1654        result = r;
    16431655      }
    16441656      else if(uns->Grammar()==GraSet())
    … …  
    16661678          result = ns.PublicMember(memberName);
    16671679        }
    1668         result = EvMemberArg
     1680        BSyntaxObject* r = EvMemberArg
    16691681          (_name_, gra, branch2, arg2, memberName, ns.Name(), errMsg, result);
     1682        DESTROY(result);
     1683        result = r;
    16701684      }
    16711685    }
    … …  
    16791693  }
    16801694  result=BSpecialFunction::TestResult(_name_,result,tre,NIL,BTRUE);
     1695  if(needsDeleteUns) { DESTROY(uns); }
     1696  BGrammar::DestroyStackUntil(stackPos, result);   
    16811697  return(result);
    16821698}
Note: See TracChangeset for help on using the changeset viewer.