def optimize(self, env, compiler): if self.has_side_effects: return self.__class__(*optimize_args(self.args, env, compiler)) args = optimize_args(self.args, env, compiler) free_vars = set() for arg in args: free_vars |= arg.free_vars() for var in free_vars: assign = None try: assign = env[var] except: pass if assign is not None: assign.dont_remove() result = self.__class__(*args) return result
def optimize(self, env, compiler): caller = self.caller args = optimize_args(self.args, env, compiler) for arg in args: if not isinstance(arg, Atom): break else: return element(caller.operator_function(*tuple(arg.item for arg in args))) return self.__class__(caller, args)
def optimize(self, env, compiler): if self.has_side_effects: return self.__class__(*optimize_args(self.args, env,compiler)) args = optimize_args(self.args, env,compiler) free_vars = set() for arg in args: free_vars |= arg.free_vars() for var in free_vars: assign = None try: assign = env[var] except: pass if assign is not None: assign.dont_remove() result = self.__class__(*args) return result
def optimize(self, env, compiler): caller = self.caller args = optimize_args(self.args, env, compiler) for arg in args: if not isinstance(arg, Atom): break else: return element( caller.operator_function(*tuple(arg.item for arg in args))) return self.__class__(caller, args)