Ejemplo n.º 1
0
        public override JSValue Evaluate(Context context)
        {
            int    itemp;
            double dtemp;
            var    op = _left.Evaluate(context);

            if (op._valueType == JSValueType.Integer ||
                op._valueType == JSValueType.Boolean)
            {
                itemp = op._iValue;
                op    = _right.Evaluate(context);
                if (op._valueType == JSValueType.Integer ||
                    op._valueType == JSValueType.Boolean)
                {
                    return(itemp <= op._iValue);
                }

                if (op._valueType == JSValueType.Double)
                {
                    return(itemp <= op._dValue);
                }

                if (_tempContainer == null)
                {
                    _tempContainer = new JSValue {
                        _attributes = JsValueAttributesInternal.Temporary
                    }
                }
                ;
                _tempContainer._valueType = JSValueType.Integer;
                _tempContainer._iValue    = itemp;
                return(!More.Check(_tempContainer, op, true));
            }

            if (op._valueType == JSValueType.Double)
            {
                dtemp = op._dValue;
                op    = _right.Evaluate(context);
                if (op._valueType == JSValueType.Integer ||
                    op._valueType == JSValueType.Boolean)
                {
                    return(dtemp <= op._iValue);
                }

                if (op._valueType == JSValueType.Double)
                {
                    return(dtemp <= op._dValue);
                }

                if (_tempContainer == null)
                {
                    _tempContainer = new JSValue {
                        _attributes = JsValueAttributesInternal.Temporary
                    }
                }
                ;
                _tempContainer._valueType = JSValueType.Double;
                _tempContainer._dValue    = dtemp;
                return(!More.Check(_tempContainer, op, true));
            }

            if (_tempContainer == null)
            {
                _tempContainer = new JSValue {
                    _attributes = JsValueAttributesInternal.Temporary
                }
            }
            ;
            var temp = _tempContainer;

            temp.Assign(op);
            _tempContainer = null;
            var res = !More.Check(temp, _right.Evaluate(context), true);

            _tempContainer = temp;
            return(res);
        }
Ejemplo n.º 2
0
        public override JSValue Evaluate(Context context)
        {
            var op = _left.Evaluate(context);

            switch (op._valueType)
            {
            case JSValueType.Integer:
            case JSValueType.Boolean:
                var itemp = op._iValue;
                op = _right.Evaluate(context);
                switch (op._valueType)
                {
                case JSValueType.Integer:
                case JSValueType.Boolean:
                    return(itemp > op._iValue);

                case JSValueType.Double:
                    return(itemp > op._dValue);
                }

                if (_tempContainer == null)
                {
                    _tempContainer = new JSValue {
                        _attributes = JsValueAttributesInternal.Temporary
                    }
                }
                ;
                _tempContainer._valueType = JSValueType.Integer;
                _tempContainer._iValue    = itemp;
                return(More.Check(_tempContainer, op, false));

            case JSValueType.Double:
                var dtemp = op._dValue;
                op = _right.Evaluate(context);
                switch (op._valueType)
                {
                case JSValueType.Integer:
                case JSValueType.Boolean:
                    return(dtemp > op._iValue);

                case JSValueType.Double:
                    return(dtemp > op._dValue);
                }

                if (_tempContainer == null)
                {
                    _tempContainer = new JSValue {
                        _attributes = JsValueAttributesInternal.Temporary
                    }
                }
                ;
                _tempContainer._valueType = JSValueType.Double;
                _tempContainer._dValue    = dtemp;
                return(More.Check(_tempContainer, op, false));
            }

            if (_tempContainer == null)
            {
                _tempContainer = new JSValue {
                    _attributes = JsValueAttributesInternal.Temporary
                }
            }
            ;

            var temp = _tempContainer;

            temp.Assign(op);
            _tempContainer = null;
            var res = More.Check(temp, _right.Evaluate(context), false);

            _tempContainer = temp;
            return(res);
        }