[opengtl-commits] [346] convert right hand side expression to left hand side type

[ Thread Index | Date Index | More lists.tuxfamily.org/opengtl-commits Archives ]


Revision: 346
Author:   cyrille
Date:     2008-09-02 00:20:16 +0200 (Tue, 02 Sep 2008)

Log Message:
-----------
convert right hand side expression to left hand side type

Modified Paths:
--------------
    trunk/OpenGTL/OpenGTL/GTLCore/ParserBase_p.cpp


Modified: trunk/OpenGTL/OpenGTL/GTLCore/ParserBase_p.cpp
===================================================================
--- trunk/OpenGTL/OpenGTL/GTLCore/ParserBase_p.cpp	2008-09-01 22:09:00 UTC (rev 345)
+++ trunk/OpenGTL/OpenGTL/GTLCore/ParserBase_p.cpp	2008-09-01 22:20:16 UTC (rev 346)
@@ -1236,11 +1236,21 @@
   }
   if( token.type == Token::EQUAL )
   {
+    rhs = d->compiler->convertCenter()->createConvertExpression( rhs, lhs->type() );
+    if( not rhs )
+    {
+      delete lhs;
+      delete rhs;
+      reportError("Can't convert right hand side value to the left hand side type.", token);
+      return 0;
+    }
     AST::AccessorExpression* ve = dynamic_cast<AST::AccessorExpression*>( lhs );
     if( ve )
     {
       return new AST::AssignementBinaryExpression( ve, rhs );
     }
+    delete lhs;
+    delete rhs;
     reportError("Left hand side of an assignement expression must be a variable.", token);
     return 0;
     


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/