Esempio n. 1
0
 def modifyDeclareStmt(self, node):
     ''' only keep used variables '''
     statements = ASTModifier.modifyDeclareStmt(self, node)
     if len(statements) == 1:
         node = statements[0]
         is_ui_variable = node.modifiers is not None and any([m.lower().startswith('ui_') for m in node.modifiers])
         if not str(node.variable).lower() in self.used_variables and not is_ui_variable:
             return []
         else:
             return [node]
     else:
         return flatten([self.modify(stmt) for stmt in statements])
Esempio n. 2
0
 def modifyDeclareStmt(self, node):
     ''' only keep used variables '''
     statements = ASTModifier.modifyDeclareStmt(self, node)
     if len(statements) == 1:
         node = statements[0]
         is_ui_variable = node.modifiers is not None and any(
             [m.lower().startswith('ui_') for m in node.modifiers])
         if not str(node.variable).lower(
         ) in self.used_variables and not is_ui_variable:
             return []
         else:
             return [node]
     else:
         return flatten([self.modify(stmt) for stmt in statements])
Esempio n. 3
0
 def modifyDeclareStmt(self, node):
     ASTModifier.modifyDeclareStmt(self, node)
     if 'const' in node.modifiers and self.replace_constants:
         return []
     else:
         return [node]
Esempio n. 4
0
 def modifyDeclareStmt(self, node):
     ASTModifier.modifyDeclareStmt(self, node)
     return [node]
Esempio n. 5
0
 def modifyDeclareStmt(self, node):
     ASTModifier.modifyDeclareStmt(self, node)
     if 'const' in node.modifiers and self.replace_constants:
         return []
     else:
         return [node]