Example #1
0
 def compute_assign(self, env, rvalue):
     l = self.left()
     if isinstance(l, literal.Name):
         l.eval_for_assign(env, rvalue)
         return rvalue
     else:
         return super(BinaryEx2, self).compute_assign(env, rvalue)
Example #2
0
 def compute_assign(self, env, rvalue):
     le = self.left()
     if isinstance(le, expression.PrimaryExpr):
         p = le
         if p.has_postfix(0) and isinstance(p.postfix(0), cls.Dot):
             t = le.eval_sub_expr(env, 1)
             if isinstance(t, stone_object.StoneObject):
                 return self.set_field(t, p.postfix(0), rvalue)
     return super(AssignEx, self).compute_assign(env, rvalue)
Example #3
0
 def eval(self, caller_env, value):
     if not value.__class__ == native_function.NativeFunction:
         return super(NativeArgEx, self).eval(caller_env, value)
     func = value
     nparams = func.num_of_parameters()
     if self.size() != nparams:
         raise exception.StoneException("bad number of arguments", self)
     args = []
     for a in self.children():
         args.append(a.eval(caller_env))
     return func.invoke(args, self)
Example #4
0
 def eval(self, env, value):
     if isinstance(value, opt_stone_object.OptStoneObject):
         target = value
         if target.class_info() != self.class_info:
             self.update_cache(target)
         if self.is_field:
             return target.read(self.index)
         else:
             return target.method(self.index)
     else:
         return super(DotEx2, self).eval(env, value)
Example #5
0
 def compute_assign(self, env, rvalue):
     le = self.left()
     if isinstance(le, expression.PrimaryExpr):
         p = le
         if p.has_postfix(0) and isinstance(p.postfix(0), fun.ArrayRef):
             a = le.eval_sub_expr(env, 1)
             if isinstance(a, list):
                 aref = p.postfix(0)
                 index = aref.index().eval(env)
                 if isinstance(index, int):
                     a[index] = rvalue
                     return rvalue
             raise exception.StoneException("bad array access", self)
     return super(AssignEx, self).compute_assign(env, rvalue)
Example #6
0
 def __init__(self, list_of_astree):
     super(BinaryEx2, self).__init__(list_of_astree)
Example #7
0
 def __init__(self, list_of_astree):
     super(ParamsEx, self).__init__(list_of_astree)
Example #8
0
 def __init__(self, list_of_astree):
     super(ArgumentsEx, self).__init__(list_of_astree)
Example #9
0
 def __init__(self, list_of_astree):
     super(PostfixEx, self).__init__(list_of_astree)
Example #10
0
 def __init__(self, list_of_astree):
     super(ParamsEx, self).__init__(list_of_astree)
     self.offsets = None
Example #11
0
 def __init__(self, list_of_astree):
     super(DefStmntEx, self).__init__(list_of_astree)
Example #12
0
 def __init__(self, list_of_astree):
     super(ClassBodyEx, self).__init__(list_of_astree)
Example #13
0
 def __init__(self, list_of_astree):
     super(NativeArgEx, self).__init__(list_of_astree)
Example #14
0
 def __init__(self, list_of_astree):
     super(DotEx2, self).__init__(list_of_astree)
     self.class_info = None
     self.is_field = False
     self.index = 0
Example #15
0
 def __init__(self, list_of_astree):
     super(AssignEx2, self).__init__(self, list_of_astree)
     self.class_info = None
     self.index = 0
Example #16
0
 def __init__(self, t):
     super(NameEx2, self).__init__(t)
Example #17
0
 def __init__(self, list_of_astree):
     super(ASTListEx, self).__init__(list_of_astree)
Example #18
0
 def __init__(self, list_of_astree):
     super(AssignEx, self).__init__(list_of_astree)
Example #19
0
 def __init__(self, list_of_astree):
     super(FunEx, self).__init__(list_of_astree)
     self.size = -1
Example #20
0
 def __init__(self, list_of_astree):
     super(PrimaryEx, self).__init__(list_of_astree)
Example #21
0
 def __init__(self, token):
     super(NameEx, self).__init__(token)
Example #22
0
 def __init__(self, list_of_astree):
     super(ArrayRefEx, self).__init__(list_of_astree)