Changeset 194e48b in tol


Ignore:
Timestamp:
Apr 27, 2011, 5:28:04 PM (15 years ago)
Author:
Víctor de Buen <vdebuen@…>
Branches:
1941-docker-image-to-test, devel, master
Children:
a5bc35a
Parents:
13977f3
Message:

Fixes #1178

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

File:
1 edited

Legend:

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

    r13977f3 r194e48b  
    986986{
    987987  static BText _name_ = "PutDescription";
     988  static BText third_arg_error =
     989    I2("Optional third argument of PutDescription must be the name of a member "
     990       "of the class specified in second one",
     991       "El tercer argumento opcional de PutDescription debe ser el nombre de "
     992       "un miembro de la clase especificada en el segundo argumento");
     993
    988994//if(CheckNonDeclarativeAction(_name_)) { return(NULL); }
    989995  BInt nb = BSpecialFunction::NumBranches(tre);
    990   if(BSpecialFunction::TestNumArg(_name_, 2, nb, 2))
     996  if(BSpecialFunction::TestNumArg(_name_, 2, nb, 3))
    991997  {
    992998    BSyntaxObject* desObj = GraText    ()->EvaluateTree(Branch(tre,1));
     999    if(!desObj) { return(NULL); }
     1000    BText desc = Text(desObj);
    9931001    BGrammar::PutLast(gra);
    9941002    BText tokenName = BParser::treToken(Branch(tre,2))->Name();
    … …  
    9981006      tokenName = tokenName.SubString(1,tokenName.Length());
    9991007      obj = FindStruct(tokenName);
     1008      if(obj && nb==3)
     1009      { 
     1010        Error(third_arg_error);
     1011      }
    10001012      if(!obj)
    10011013      {
    10021014        obj = FindClass(tokenName,-1);
    1003       }
     1015        if(obj && nb==3)
     1016        {
     1017          BText memberName = BParser::treToken(Branch(tre,3))->Name();
     1018          if(memberName[0]=='\"')
     1019          {
     1020            memberName = memberName.SubString(1,memberName.Length());
     1021            BClass* cls = (BClass*)obj;
     1022            BMember* mbr = cls->FindMember(memberName);
     1023            if(!mbr)
     1024            { 
     1025              Error(third_arg_error);
     1026            }
     1027            else
     1028            {
     1029              BSyntaxObject* adoc = cls->FindStaticMember(BText("_.autodoc.member.")+memberName, false);
     1030              if(adoc) { Text(adoc)=desc; }
     1031              if(mbr->method_) { obj=mbr->method_; }
     1032              else if(mbr->static_) { obj=mbr->static_; }
     1033            }
     1034          }
     1035          else
     1036          { 
     1037            Error(third_arg_error);
     1038          }
     1039        }
     1040      }
     1041    }
     1042    else if (nb==3)
     1043    {
     1044      Error(third_arg_error);
    10041045    }
    10051046    if(!obj)
    … …  
    10081049    };
    10091050    BGrammar::PutLast(gra);
    1010     if(desObj && obj)
    1011     {
    1012       BText desc = Text(desObj);
     1051    if(obj)
     1052    {
    10131053      obj->PutDescription(desc);
    10141054      if(obj->Grammar()==GraCode())
Note: See TracChangeset for help on using the changeset viewer.