Changeset 990c4f3 in tol


Ignore:
Timestamp:
Apr 8, 2009, 7:46:45 AM (18 years ago)
Author:
Víctor de Buen <vdebuen@…>
Branches:
1941-docker-image-to-test, devel, master
Children:
4c00cc7
Parents:
1737efa
Message:

Allowing multiple use of :: in GetLeft
Warning of local variables hiding members
Fixed bug in currentFullName_ recovering

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

File:
1 edited

Legend:

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

    r1737efa r990c4f3  
    539539  str=NULL;
    540540  cls = NULL;
     541  rest = NULL;
    541542  if((tok->TokenType() == TYPE))
    542543  {
    … …  
    568569  else if((tok->TokenType()==BINARY)&&(tok->Name()=="::"))
    569570  {
     571  //BText expr = BParser::Unparse(left);
     572  //Std(BText("Unparse(left)=\n")<<BParser::Unparse(left)+"\n");
    570573    List* nbLst = Tree::treLeft(left);
    571     BToken* nbTok = BParser::treToken(nbLst);
    572     const BText& nbName = nbTok->Name();
    573     BUserNameBlock* unb = (BUserNameBlock*)GraNameBlock()->FindOperand(nbName,false);
     574  //Std(BText("Unparse(nbLst)=\n")<<BParser::Unparse(nbLst)+"\n");
     575    BUserNameBlock* unb = (BUserNameBlock*)GraNameBlock()->LeftEvaluateTree(nbLst);
    574576    if(unb)
    575577    {
    … …  
    672674    {
    673675      TRACE_SHOW_MEDIUM(fun," 6");
    674       result = BGrammar::FindLocal(name);
    675       TRACE_SHOW_MEDIUM(fun," 7");
    676       if(result && (result->Level()!=level)) { result = NIL; }
     676
     677      if(!BEqualOperator::CreatingName().HasName())
     678      {
     679        result = BNameBlock::LocalMember(name);
     680        if(result && result->NameBlock())
     681        {
     682          Warning(I2("Local variable","La variable local")+
     683                  " "+gra->Name()+" "+name+" "+
     684                  I2("hides published NameBlock member",
     685                     "oculta el miembro de NameBlock publicado")+
     686                  " "+result->FullName());
     687          BUserFunction::ShowCallStack();
     688          result = NULL;
     689        }
     690      }
     691      if(!result)
     692      {
     693        result = BGrammar::FindLocal(name);
     694        TRACE_SHOW_MEDIUM(fun," 7");
     695        if(result && (result->Level()!=level)) { result = NIL; }
     696      }
    677697    }
    678     else result = gra->FindVariable(name);
    679     if(result && result->NameBlock())
    680     {
    681       Warning(I2("Global variable","La variable global")+
    682               " "+gra->Name()+" "+name+" "+
    683               I2("hides published NameBlock member",
    684                  "oculta el miembro de NameBlock publicado")+
    685               " "+result->FullName());
    686       result = NULL;
     698    else
     699    {
     700      result = gra->FindVariable(name);
     701      if(result && result->NameBlock())
     702      {
     703        Warning(I2("Global variable","La variable global")+
     704                " "+gra->Name()+" "+name+" "+
     705                I2("hides published NameBlock member",
     706                   "oculta el miembro de NameBlock publicado")+
     707                " "+result->FullName());
     708        result = NULL;
     709      }
    687710    }
    688711    if(result) // send an error messages
    … …  
    691714      BText functionName = "";
    692715      BText functionPath = "";
    693       BText sentence = result->Description();
     716      BText sentence = result->FullName() + " " +result->Description();
    694717#     ifdef WINDOWS
    695718      path += BText("\n")+SysPath(path);
    … …  
    711734                I2("' already defined as ",
    712735                   "' ya definida como \"") + sentence + "\"\n");
    713         }
     736          }
    714737        else
    715738        {
    … …  
    844867    {
    845868      currentFullName_ = currentFullName_ + "::" +name;
     869    //Std(BText("\nTRACE currentFullName_ <- ")<<currentFullName_+"\n");
    846870    }
    847871    else
    848872    {
    849873      currentFullName_ = name;
     874    //Std(BText("\nTRACE currentFullName_ <- ")<<currentFullName_+"\n");
    850875    }
    851876    creatingClass_ = cls;
    … …  
    853878  if(!rest && gra)
    854879  {
    855     if(defInst)
    856     {
    857             result = CreateObject(left, gra, name);
    858     }
    859     else
    860     {
    861             result = CreateObject(left, gra, name);
    862     }
     880    result = CreateObject(left, gra, name);
    863881    if(str && result)
    864882    {
    … …  
    887905  if(isNameBlock)
    888906  {
    889     currentFullName_ = currentFatherName_;
     907    currentFullName_ = oldFullName;
     908  //Std(BText("\nTRACE currentFullName_ <- ")<<currentFullName_+"\n");
    890909    creatingName_    = oldName;
    891910    creatingClass_   = oldClass;
    … …  
    14251444    BStruct*  str  = NIL;
    14261445    BClass*   cls  = NIL;
     1446    bool carIsList = dec->car()->IsListClass();
     1447    List* decLst = carIsList?Tree::treNode((List*) dec):(List*)dec;
    14271448    BGrammar* gra  = GetLeft
    14281449    (
    1429       NIL, Tree::treNode(dec),
     1450      NIL, decLst,
    14301451      names_[n], rest, str, cls
    14311452    );
Note: See TracChangeset for help on using the changeset viewer.