def patch(node): patchCount = 0 classDefNodes = list(treeutil.findQxDefineR(node)) for classDefNode in classDefNodes: patchCount += optimize(classDefNode, classDefNodes) return patchCount
def node_is_defer_value(self, node): is_defer = False # find qxDefine in tree for qx_def_node in treeutil.findQxDefineR(self.root_node): class_map = treeutil.getClassMap(qx_def_node) if 'defer' in class_map and class_map['defer'] == node: is_defer = True break return is_defer
def process(node, globals_map): # make sure we have current scope tree node = scopes.create_scopes(node) # replace globals in tree globals_optimizer = GlobalsOptimizer(globals_map) globals_optimizer.visit(node.scope) # get new globals from tree new_symbols = list(treeutil.findQxDefineR(node)) new_names = operands_of_calls(new_symbols) # add to globals_map for new_name in new_names: globals_map.add(new_name) # this will create replacements if they're new # add defining code lines to closure propagate_new_globals(node, new_names, globals_map)
def visit_file(self, node): # we can run the basic scope checks as with function nodes if not self.opts.ignore_undefined_globals: self.function_unknown_globals(node) self.function_unused_vars(node) if not self.opts.ignore_deprecated_symbols: self.function_used_deprecated(node) if not self.opts.ignore_multiple_vardecls: self.function_multiple_var_decls(node) # this is also good to check class map integrity for class_defn in treeutil.findQxDefineR(node): if not self.opts.ignore_undeclared_privates: self.class_declared_privates(class_defn) if not self.opts.ignore_reference_fields: self.class_reference_fields(class_defn) # check all qx.core.Environment calls self.environment_check_calls(node) # recurse for cld in node.children: self.visit(cld)
def visit_file(self, node): # we can run the basic scope checks as with function nodes if not self.opts.ignore_undefined_globals: self.unknown_globals(node.scope) self.function_unused_vars(node) if not self.opts.ignore_deprecated_symbols: self.function_used_deprecated(node) if not self.opts.ignore_multiple_vardecls: self.function_multiple_var_decls(node) # this is also good to check class map integrity for class_defn in treeutil.findQxDefineR(node): if not self.opts.ignore_undeclared_privates: self.class_declared_privates(class_defn) if not self.opts.ignore_reference_fields: self.class_reference_fields(class_defn) # check all qx.core.Environment calls self.environment_check_calls(node) # recurse for cld in node.children: self.visit(cld)