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])
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])
def modifyDeclareStmt(self, node): ASTModifier.modifyDeclareStmt(self, node) if 'const' in node.modifiers and self.replace_constants: return [] else: return [node]
def modifyDeclareStmt(self, node): ASTModifier.modifyDeclareStmt(self, node) return [node]
def modifyDeclareStmt(self, node): ASTModifier.modifyDeclareStmt(self, node) if 'const' in node.modifiers and self.replace_constants: return [] else: return [node]