Пример #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));
 }