certi-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[certi-cvs] certi/scripts GenMsgAST.py


From: certi-cvs
Subject: [certi-cvs] certi/scripts GenMsgAST.py
Date: Mon, 08 Mar 2010 12:52:11 +0000

CVSROOT:        /sources/certi
Module name:    certi
Changes by:     Eric NOULARD <erk>      10/03/08 12:52:11

Modified files:
        scripts        : GenMsgAST.py 

Log message:
        Enhance error handling

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/certi/scripts/GenMsgAST.py?cvsroot=certi&r1=1.4&r2=1.5

Patches:
Index: GenMsgAST.py
===================================================================
RCS file: /sources/certi/certi/scripts/GenMsgAST.py,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- GenMsgAST.py        7 Mar 2010 18:22:03 -0000       1.4
+++ GenMsgAST.py        8 Mar 2010 12:52:11 -0000       1.5
@@ -17,7 +17,7 @@
 ## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
 ## USA
 ##
-## $Id: GenMsgAST.py,v 1.4 2010/03/07 18:22:03 erk Exp $
+## $Id: GenMsgAST.py,v 1.5 2010/03/08 12:52:11 erk Exp $
 ## ----------------------------------------------------------------------------
 
 """
@@ -461,7 +461,6 @@
             if not AST.isDefined(f.typeid):
                 self.logger.fatal("The type <%s> used for field <%s.%s> is 
unknown (not a builtin, nor native, nor message)" % (f.typeid,msg.name,f.name))
                 self.logger.fatal(" --> Check lines (%d,%d)" % (f.linespan) + 
" of <%s>" % AST.name)
-                AST.checked = False
                 return
             else:
                 if (isinstance(f,MessageType.MessageField)):                   
@@ -480,6 +479,9 @@
         @type AST: C{MessageAST}  
         """
         
+        # Consider the AST not checked.
+        AST.checked = False
+        
         # check if the supplied object has appropriate super type
         # @todo: note that we may just require to have the appropriate
         #        fields and not being sub-class of MesssageAST.
@@ -487,7 +489,6 @@
         #        see: http://docs.python.org/library/inspect.html
         if not isinstance(AST, MessageAST):
            self.logger.error("The supplied object is not an instance of 
MessageAST: <%s>" % type(AST))
-           AST.checked = False 
            return
        
         # check if all field used in message have known types
@@ -524,7 +525,6 @@
                 if not AST.isDefined(msg.merge):
                     self.logger.fatal("The merge target <%s> of message <%s> 
is unknown (not a builtin, nor native, nor message)" % (msg.merge,msg.name))
                     self.logger.fatal(" --> Check lines (%d,%d)" % 
(msg.linespan) + " of <%s>" % AST.name )                    
-                    AST.checked = False
                     return
                 else:
                     msg.merge = AST.getType(msg.merge)
@@ -534,23 +534,19 @@
             if not AST.isDefined(AST.factory.creator[0]):
                 self.logger.fatal("The return type <%s> of the creator factory 
method is unknown (not a builtin, nor native, nor message)" % 
AST.factory.creator[0])
                 self.logger.fatal(" --> Check lines (%d,%d)" % 
(AST.factory.linespan) + " of <%s>" % AST.name )
-                AST.checked = False
                 return
             if not AST.isDefined(AST.factory.creator[2]):
                 self.logger.fatal("The parameter type <%s> of the creator 
factory method is unknown (not a builtin, nor native, nor message)" % 
AST.factory.creator[2])
                 self.logger.fatal(" --> Check lines (%d,%d)" % 
(AST.factory.linespan) + " of <%s>" % AST.name )
-                AST.checked = False
                 return
             if not AST.isDefined(AST.factory.receiver[0]):
                 self.logger.fatal("The return type <%s> of the receiver 
factory method is unknown (not a builtin, nor native, nor message)" % 
AST.factory.receiver[0])
                 self.logger.fatal(" --> Check lines (%d,%d)" % 
(AST.factory.linespan) + " of <%s>" % AST.name )
-                AST.checked = False
                 return
             if not AST.isDefined(AST.factory.receiver[2]):
                 self.logger.fatal("The parameter type <%s> of the receiver 
factory method is unknown (not a builtin, nor native, nor message)" % 
AST.factory.receiver[2])
                 self.logger.fatal(" --> Check lines (%d,%d)" % 
(AST.factory.linespan) + " of <%s>" % AST.name )
-                AST.checked = False
                 return
-                
+        # Now the AST has been checked successfully
         AST.checked = True                  
                                                                                
  
\ No newline at end of file




reply via email to

[Prev in Thread] Current Thread [Next in Thread]