Changeset c0b3749 in tol


Ignore:
Timestamp:
Sep 1, 2009, 8:38:59 AM (17 years ago)
Author:
Víctor de Buen <vdebuen@…>
Branches:
1941-docker-image-to-test, devel, master
Children:
8d67ff3
Parents:
83ac76d
Message:

New member BClass* staticOwner_ to allow FullName and access to other static elements from an static method

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

Location:
tol/btol/bgrammar
Files:
3 edited

Legend:

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

    r83ac76d rc0b3749  
    851851  definition_ (NIL),
    852852  declare_(""),
    853   define_("")
     853  define_(""),
     854  staticOwner_(NULL)
    854855{
    855856  PutName(name);
    … …  
    874875  definition_ (NIL),
    875876  declare_(""),
    876   define_("")
     877  define_(""),
     878  staticOwner_(NULL)
    877879{
    878880  PutName(name);
    879881  PutDescription(name);
    880882  SetExpression(dec, def);
    881 
    882883}
    883884
  • tol/btol/bgrammar/oprimp.cpp

    r83ac76d rc0b3749  
    674674    {
    675675      TRACE_SHOW_MEDIUM(fun," 6");
    676 
     676/*
    677677      if(!BEqualOperator::CreatingName().HasName())
    678678      {
    … …  
    689689        }
    690690      }
     691*/
    691692      if(!result)
    692693      {
    … …  
    14341435
    14351436//--------------------------------------------------------------------
     1437BText BUserFunction::FullName() const
     1438   
     1439/*! Returns a text with all important information about this operator
     1440 */
     1441//--------------------------------------------------------------------
     1442{
     1443  if(staticOwner_) { return(staticOwner_->FullName()+"::"+Name()); }
     1444  else             { return(BSyntaxObject::FullName()); }
     1445}
     1446
     1447
     1448//--------------------------------------------------------------------
    14361449BText BUserFunction::Dump() const
    14371450   
    … …  
    16131626    const BNameBlock* oldNameBlock = BNameBlock::Current();
    16141627    const BNameBlock* funNameBlock = NameBlock();
    1615     bool change = (funNameBlock || !Level() ) && (funNameBlock != oldNameBlock);
    1616     if(change)
    1617     {
    1618     /*Std(BText("\nBUserFunction::Evaluator ")+FullName()+
    1619         " changing new current NameBlock to "+
    1620         (funNameBlock?funNameBlock->Name():"NULL")+"\n");*/
     1628    const BClass* oldStaticOwner = BClass::currentStatic_;
     1629    if(funNameBlock)
     1630    {
    16211631      BNameBlock::SetCurrent(funNameBlock);
     1632      BClass::currentStatic_ = funNameBlock->Class();
     1633    }
     1634    else
     1635    {
     1636      BClass::currentStatic_ = staticOwner_;
    16221637    }
    16231638    result = Grammar()->EvaluateTree(definition_, 1);
    1624     if(change)
    1625     {
    1626     /*Std(BText("\nBUserFunction::Evaluator ")+FullName()+
    1627         " recovering old current NameBlock to "+
    1628         (oldNameBlock?oldNameBlock->Name():"NULL")+"\n");*/
    1629       BNameBlock::SetCurrent(oldNameBlock);
    1630     }
     1639    BClass::currentStatic_ = oldStaticOwner;
     1640    BNameBlock::SetCurrent(oldNameBlock);
    16311641  }
    16321642  if(result)
  • tol/btol/bgrammar/tol_boper.h

    r83ac76d rc0b3749  
    414414    BArray<BSyntaxObject*> lastCalling_;
    415415    BArray<BText> names_;
    416    
     416
    417417 public:
     418    const BClass* staticOwner_;
     419
    418420    // Constructors and destructors: opr.cpp
    419421    BUserFunction(const BText& name, BGrammar* gra);
    … …  
    429431    BInt Mode() const { return BUSERFUNMODE; };
    430432
    431           BText  Dump()       const;
     433    BText  FullName() const;
     434    BText  Dump    () const;
    432435   
    433436    const List*  Declaration() const { return(declaration_); }
Note: See TracChangeset for help on using the changeset viewer.