public override IValue interpret(Context context) { IValue lval = left.interpret(context); IValue rval = right.interpret(context); return(lval.Add(context, rval)); }
public static int Main() { FooBarStruct fooBar = new FooBarStruct(); fooBar._val = 10; IValue foo = (IValue)fooBar; Console.WriteLine("Calling IFoo.Foo on FooBarStruct"); Test.Assert(foo.Add(10) == 20, "Calling default method IValue.Add on FooBarStruct failed"); Test.Assert(fooBar.GetValue() == 10, "FooBarStruct value should remain unchanged"); return(Test.Ret()); }
public override IValue Add(IValue other) { return(other.Add(this)); }