예제 #1
0
 /**
  * Handles the given binary-assignment-operator
  * 
  * @param string $op the operator (+,-,...)
  * @param PC_Obj_Variable $var the variable
  * @param PC_Obj_MultiType $e the expression
  * @return PC_Obj_MultiType the result
  */
 public function handle_bin_assign_op($op, $var, $e)
 {
     if (!$var instanceof PC_Obj_Variable) {
         return $this->handle_error('$var is invalid');
     }
     if (!$e instanceof PC_Obj_MultiType) {
         return $this->handle_error('$e is invalid');
     }
     // it does not exist, if it's not a local/global variable, e.g., a class field
     if ($this->vars->exists($this->scope->get_name(), $var->get_name())) {
         // since the variable does not occur literally in the code, we have to emulate a read access
         $this->vars->get($this->scope->get_name(), $var->get_name());
     }
     $res = $this->handle_bin_op($op, $var->get_type(), $e);
     $this->set_var($var, $res, true);
     return $res;
 }