CSLE.RegHelper_Dele.Math2Value C# (CSharp) Method

Math2Value() public method

public Math2Value ( CLS_Content env, char code, object left, CLS_Content right, CLType &returntype ) : object
env CLS_Content
code char
left object
right CLS_Content
returntype CLType
return object
        public override object Math2Value(CLS_Content env, char code, object left, CLS_Content.Value right, out CLType returntype)
        {
            returntype = null;

            Delegate rightDele = null;
            if (right.value is DeleFunction)
                rightDele = CreateDelegate(env.environment, right.value as DeleFunction);
            else if (right.value is DeleLambda)
                rightDele = CreateDelegate(env.environment, right.value as DeleLambda);
            else if (right.value is Delegate)
                rightDele = right.value as Delegate;

            if (rightDele != null)
            {
                Delegate leftDele = left as Delegate;
                if (left == null)
                    return rightDele;

                if (code == '+')
                    return Delegate.Combine(leftDele, rightDele);
                if (code == '-')
                    return Delegate.Remove(leftDele, rightDele);
            }

            throw new NotSupportedException("" + right.value);
        }