Ejemplo n.º 1
0
        public override Completion Evaluate(Interpreter interpreter)
        {
            var left = logicalOrExpression.Evaluate(interpreter).GetValue();

            if (left.IsAbrupt())
            {
                return(left);
            }
            var leftValue = left.value !;

            if (leftValue.ToBoolean().boolean)
            {
                return(Completion.NormalCompletion(leftValue));
            }
            return(logicalAndExpression.Evaluate(interpreter).GetValue());
        }
Ejemplo n.º 2
0
        public override Completion Evaluate(Interpreter interpreter)
        {
            var conditionComp = logicalOrExpression.Evaluate(interpreter).GetValue();

            if (conditionComp.IsAbrupt())
            {
                return(conditionComp);
            }
            var condition = conditionComp.value !.ToBoolean();

            if (condition.boolean)
            {
                return(ifTrueAssignmentExpression.Evaluate(interpreter).GetValue());
            }
            else
            {
                return(ifFalseAssignmentExpression.Evaluate(interpreter).GetValue());
            }
        }