Changeset 492d323 in tol


Ignore:
Timestamp:
Feb 23, 2011, 8:51:11 AM (16 years ago)
Author:
Víctor de Buen <vdebuen@…>
Branches:
1941-docker-image-to-test, devel, master
Children:
5430aa8
Parents:
de1c7d8
Message:

Fixes #1018
When a syntax error is found but an object is already created, it must be destroyed

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

File:
1 edited

Legend:

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

    rde1c7d8 r492d323  
    451451      if (!(gra1->Name()==gra2->Name()))
    452452      {
    453         Error(name + I2(" is not a reference.",
    454                         " no es una referencia de tipo ") + gra1->Name()+
    455                      I2(" but it's a reference of type ",
    456                         " sino de tipo ")+gra2->Name());
    457          error = true;
    458          result = NIL;
     453        if(BOut::IsEnabled())
     454        {
     455          Error(name + I2(" is not a reference.",
     456                          " no es una referencia de tipo ") + gra1->Name()+
     457                       I2(" but it's a reference of type ",
     458                          " sino de tipo ")+gra2->Name());
     459        }
     460        error = true;
     461        DESTROY(result);
    459462      }
    460463    }
    … …  
    539542                 "Expresión no válida para formación de matrices : \n") +
    540543              BParser::Unparse(tre, "  ", "\n"));
     544      DESTROY(result);
    541545        return(NIL);
    542546    }
    … …  
    710714  else if((type == TYPE) && (name=="#Require"))
    711715  {
     716    DESTROY(result);
    712717    return(NULL); 
    713718  }
    … …  
    817822      else     
    818823      {
    819         BGrammar* rg = result->Grammar();
    820       //if(!rg && (name=="::"))
    821         BText rgn = (rg)?rg->Name():"UNKNOWN TYPE";
    822         BText tgn = this->Name();
    823         BText rid = (rg)?result->Identify():BParser::Unparse(tre, "  ", "\n");
    824         TRACE_SHOW_MEDIUM(fun,"3.3.1.2");
    825         BText en = BText("It has not been possible to convert from ")+
    826                    rgn+ " to "+
    827                    tgn+ " for object '"+
    828                    rid+"'";
    829         BText es = BText("No ha sido posible convertir de ")+
    830                    rgn+ " hacia "+
    831                    tgn + " para el objeto '"+
    832                    rid+"'";
    833         Error(I2(en,es));
    834         result = NIL;
     824        if(BOut::IsEnabled())
     825        {
     826          BGrammar* rg = result->Grammar();
     827        //if(!rg && (name=="::"))
     828          BText rgn = (rg)?rg->Name():"UNKNOWN TYPE";
     829          BText tgn = this->Name();
     830          BText rid = (rg)?result->Identify():BParser::Unparse(tre, "  ", "\n");
     831          TRACE_SHOW_MEDIUM(fun,"3.3.1.2");
     832          BText en = BText("It has not been possible to convert from ")+
     833                     rgn+ " to "+
     834                     tgn+ " for object '"+
     835                     rid+"'";
     836          BText es = BText("No ha sido posible convertir de ")+
     837                     rgn+ " hacia "+
     838                     tgn + " para el objeto '"+
     839                     rid+"'";
     840          Error(I2(en,es));
     841        }
     842        DESTROY(result);
    835843      }
    836844    }
    … …  
    894902  {
    895903    BClass* cls = (BClass*) result;
    896     if(!cls->isDefined_) { result = NULL; }
     904    if(!cls->isDefined_)
     905    {
     906      DESTROY(result);
     907      result = NULL;
     908    }
    897909  }
    898910  return(result);
Note: See TracChangeset for help on using the changeset viewer.