Changeset d108507 in tol


Ignore:
Timestamp:
Jan 2, 2010, 4:22:40 PM (17 years ago)
Author:
Víctor de Buen <vdebuen@…>
Branches:
1941-docker-image-to-test, devel, master
Children:
f9b4992
Parents:
7618682
Message:

Checking all declared Static elements are well defined

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

File:
1 edited

Legend:

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

    r7618682 rd108507  
    352352    isStatic_ = true;
    353353  }
    354   if(!static_ && isStatic_ && definition_.HasName())
     354  if(!static_ && isStatic_)
    355355  {
    356356    BClass* cls = (BClass*)parent_;
    357     BGrammar::IncLevel();
    358     int stackPos = BGrammar::StackSize();
    359     const BClass* oldStaticOwner = BClass::currentStatic_;
    360     BClass::currentStatic_ = cls;
    361     BSyntaxObject* obj = GraAnything()->EvaluateTree(branch_);
    362     BClass::currentStatic_ = oldStaticOwner;
    363     BGrammar::DestroyStackUntil(stackPos, obj);   
    364     BGrammar::DecLevel();
    365     if(obj)
    366     {
    367       static_ = obj;
    368       if(isMethod_)
    369       {
    370         if(obj->Mode()==BOBJECTMODE)
     357    if(!definition_.HasName())
     358    {
     359      Error(I2("Cannot declare an Static element without definig it "
     360               "inline",
     361               "No se puede declarar un elemento estático sin "
     362               "definirlo en línea")+":\n"+
     363      "  Static "+BParser::Unparse(branch_,"","\n")+
     364      I2(" of Class ", "de Class ")+parent_->getName());
     365      return(0);
     366    }
     367    else
     368    {
     369      BGrammar::IncLevel();
     370      int stackPos = BGrammar::StackSize();
     371      const BClass* oldStaticOwner = BClass::currentStatic_;
     372      BClass::currentStatic_ = cls;
     373      BSyntaxObject* obj = GraAnything()->EvaluateTree(branch_);
     374      BClass::currentStatic_ = oldStaticOwner;
     375      BGrammar::DestroyStackUntil(stackPos, obj);   
     376      BGrammar::DecLevel();
     377      if(obj)
     378      {
     379        static_ = obj;
     380        if(isMethod_)
    371381        {
    372           obj = UCode(obj)->Contens().Operator();
     382          if(obj->Mode()==BOBJECTMODE)
     383          {
     384            obj = UCode(obj)->Contens().Operator();
     385          }
     386          ((BUserFunction*)obj)->staticOwner_=(const BClass*)parent_;
    373387        }
    374         ((BUserFunction*)obj)->staticOwner_=(const BClass*)parent_;
    375       }
    376       static_->IncNRefs();
    377       return(1);
    378     }
    379     else
    380     {
    381       isGood_ = false;
    382       Error(I2("Wrong syntax in static declaration ",
    383                "Sintaxis incorrecta en declaración estática ")+
    384             "static "+BParser::Unparse(branch_,"","\n")+
    385             I2(" of Class ", "de Class ")+parent_->getName());
    386       return(0);
     388        static_->IncNRefs();
     389        return(1);
     390      }
     391      else
     392      {
     393        isGood_ = false;
     394        Error(I2("Wrong syntax in static declaration ",
     395                 "Sintaxis incorrecta en declaración estática ")+
     396              "Static "+BParser::Unparse(branch_,"","\n")+
     397              I2(" of Class ", "de Class ")+parent_->getName());
     398        return(0);
     399      }
    387400    }
    388401  }
    … …  
    14571470     checkNonPrivate(this, methodName, fullAccess))
    14581471  {
    1459     result = mbr->static_;
    1460     result->PutNameBlock(NULL);
     1472    if(result = mbr->static_) { result->PutNameBlock(NULL); }
    14611473  }
    14621474  return(result);
    … …  
    14721484     checkNonPrivate(this, memberName, fullAccess))
    14731485  {
    1474     result = mbr->static_;
    1475     result->PutNameBlock(NULL);
     1486    if(result = mbr->static_) { result->PutNameBlock(NULL); }
    14761487  }
    14771488  return(result);
    … …  
    14861497  if(mbr && mbr->isStatic_  && checkNonPrivate(this, methodName, fullAccess))
    14871498  {
    1488     result = mbr->static_;
    1489     result->PutNameBlock(NULL);
     1499    if(result = mbr->static_) { result->PutNameBlock(NULL); }
    14901500  }
    14911501  return(result);
Note: See TracChangeset for help on using the changeset viewer.