Changeset fe9f3eb in tol


Ignore:
Timestamp:
Sep 11, 2009, 2:44:28 PM (17 years ago)
Author:
Víctor de Buen <vdebuen@…>
Branches:
1941-docker-image-to-test, devel, master
Children:
a5e46b1
Parents:
949a266
Message:

New method DeepMember of class instances searches members also on the owner of the class

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

File:
1 edited

Legend:

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

    r949a266 rfe9f3eb  
    859859
    860860//--------------------------------------------------------------------
     861  BSyntaxObject* BNameBlock::DeepMember(const BText& memberName) const
     862//--------------------------------------------------------------------
     863{
     864  BSyntaxObject* result = NULL;
     865  result = Member(memberName);
     866  if(!result && Class())
     867  {
     868    BSyntaxObject* met = Class()->FindMethod(memberName,true);
     869    if(met)
     870    {
     871      met->PutNameBlock(this);
     872      if(met->Mode()==BOBJECTMODE)
     873      {
     874        BUserCode* uCode = UCode(met);
     875        uCode->Contens().Operator()->PutNameBlock(this);
     876      }
     877      result = met;
     878    }
     879    if(!result && Class()->NameBlock())
     880    {
     881      result = Class()->NameBlock()->DeepMember(memberName);
     882    } 
     883  }
     884/*
     885  if(!result && Father())
     886  {
     887    if(memberName=="g")
     888      printf("");
     889    result = Father()->DeepMember(memberName);
     890  }
     891*/
     892  if(result && (result->Mode()==BSTRUCTMODE))
     893  {
     894    BStruct* bstr = (BStruct*)result;
     895    result = bstr->Function();
     896  }
     897  return(result);
     898}
     899
     900//--------------------------------------------------------------------
     901  BSyntaxObject* BNameBlock::LocalMember(const BText& memberName)
     902//--------------------------------------------------------------------
     903{
     904  BSyntaxObject* result = NULL;
     905  const BNameBlock* cns = BNameBlock::Current();
     906  if(cns) { result = cns->DeepMember(memberName); }
     907  return(result);
     908}
     909
     910/*
     911//--------------------------------------------------------------------
    861912  BSyntaxObject* BNameBlock::LocalMember(const BText& memberName)
    862913//--------------------------------------------------------------------
    … …  
    866917  while(!result && cns)
    867918  {
    868 /* */
    869919    if(cns->Class())
    870920    {
    … …  
    881931      }
    882932    }
    883 /* */
    884933    if(!result)
    885934    {
    … …  
    899948  return(result);
    900949}
     950/* */
    901951
    902952//--------------------------------------------------------------------
    … …  
    10371087    if(!dsc.HasName())
    10381088    {
    1039       BSyntaxObject* autodoc = Member(BText("_.autodoc.member.")+Name());
     1089      BText autodocName = BText("_.autodoc.member.")+Name();
     1090      BSyntaxObject* autodoc = NULL;
     1091      if(class_)
     1092      {
     1093        autodoc = class_->FindStaticMemeber(autodocName,-1);
     1094      }
     1095      else
     1096      {
     1097        autodoc = Member(autodocName);
     1098      }
    10401099      if(autodoc && autodoc->Grammar()==GraText())
    10411100      {
Note: See TracChangeset for help on using the changeset viewer.