예제 #1
0
파일: vop.py 프로젝트: hermetique/dao
    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
예제 #2
0
파일: vop.py 프로젝트: chaosim/dao
 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)
예제 #3
0
파일: vop.py 프로젝트: chaosim/dao
 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
예제 #4
0
파일: vop.py 프로젝트: hermetique/dao
 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)