예제 #1
0
        public override IValue interpret(Context context)
        {
            IValue lval = left.interpret(context);
            IValue rval = right.interpret(context);

            return(lval.Add(context, rval));
        }
예제 #2
0
    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());
    }
예제 #3
0
 public override IValue Add(IValue other)
 {
     return(other.Add(this));
 }