Ejemplo n.º 1
0
        public static JsExpression CreateJsExpression(JsToken lhs, JsBinaryOperator op, JsToken rhs)
        {
            if (op is JsAnd opAnd)
            {
                return(new JsLogicalExpression(lhs, opAnd, rhs));
            }
            if (op is JsOr opOr)
            {
                return(new JsLogicalExpression(lhs, opOr, rhs));
            }

            return(new JsBinaryExpression(lhs, op, rhs));
        }
Ejemplo n.º 2
0
 public JsBinaryExpression(JsToken left, JsBinaryOperator @operator, JsToken right)
 {
     Left     = left ?? throw new SyntaxErrorException($"Left Expression missing in Binary Expression");
     Operator = @operator ?? throw new SyntaxErrorException($"Operator missing in Binary Expression");
     Right    = right ?? throw new SyntaxErrorException($"Right Expression missing in Binary Expression");
 }