package som.interpreter.actors;

import som.vmobjects.SAbstractObject;
import som.vmobjects.SClass;
import som.vmobjects.SSymbol;

import com.oracle.truffle.api.CompilerDirectives.CompilationFinal;
import com.oracle.truffle.api.RootCallTarget;


public final class SFarReference extends SAbstractObject {
  @CompilationFinal private static SClass farReferenceClass;

  private final Actor  actor;
  private final Object value;

  public SFarReference(final Actor actor, final Object value) {
    this.actor = actor;
    this.value = value;
    assert !(value instanceof SFarReference);
  }

  public Actor getActor() {
    return actor;
  }

  public Object getValue() {
    return value;
  }

  @Override
  public SClass getSOMClass() {
    return farReferenceClass;
  }

  @Override
  public String toString() {
    return "FarRef[" + value.toString() + ", " + actor.toString() + "]";
  }

  @Override
  public boolean isValue() {
    return true;
  }

  public static void setSOMClass(final SClass cls) {
    assert farReferenceClass == null || cls == null;
    farReferenceClass = cls;
  }

  public SPromise eventualSend(final Actor currentActor, final SSymbol selector,
      final Object[] args, final RootCallTarget onReceive) {
    return actor.eventualSend(currentActor, selector, args, onReceive);
  }
}

@@ -96,38 +96,8 @@
 ass;
-%0Aimport som.vmobjects.SSymbol;
 %0A%0Aim
@@ -165,54 +165,8 @@
 al;%0A
-import com.oracle.truffle.api.RootCallTarget;%0A
 %0A%0Apu
@@ -1014,226 +1014,7 @@
 %0A  %7D
-%0A%0A  public SPromise eventualSend(final Actor currentActor, final SSymbol selector,%0A      final Object%5B%5D args, final RootCallTarget onReceive) %7B%0A    return actor.eventualSend(currentActor, selector, args, onReceive);%0A  %7D
 %0A%7D%0A

Remove dead code