コード例 #1
0
 public TernaryNode(Node x, Node y, Node z, TernaryOperator operation)
 {
     this.x         = x;
     this.y         = y;
     this.z         = z;
     this.operation = operation;
 }
コード例 #2
0
 /// <summary>
 /// Constructor of TernaryExpression
 /// </summary>
 /// <param name="operand1">First operand.</param>
 /// <param name="operand2">Second operand.</param>
 /// <param name="operand3">Third operand.</param>
 /// <param name="op">Operator of the ternary expression.</param>
 /// <param name="fileName">File name.</param>
 /// <param name="lineNumber">Line number.</param>
 /// <param name="columnNumber">Column number.</param>
 public TernaryExpression(Expression operand1, Expression operand2, Expression operand3, TernaryOperator op, Location location)
     : base(location)
 {
     this.operand1 = operand1;
     this.operand2 = operand2;
     this.operand3 = operand3;
     this.op       = op;
 }
コード例 #3
0
ファイル: FindObjects.cs プロジェクト: iamr8/IoTGateway
        private void CheckTernaryOperator(TernaryOperator Operator, Variables Variables, out string FieldName, out object Left, out object Right)
        {
            if (!(Operator.MiddleOperand is VariableReference v))
            {
                throw new ScriptRuntimeException("Middle operands in ternary filter operators need to be a variable references, as they refer to field names.", this);
            }

            FieldName = v.VariableName;
            Left      = Operator.LeftOperand.Evaluate(Variables).AssociatedObjectValue;
            Right     = Operator.RightOperand.Evaluate(Variables).AssociatedObjectValue;
        }
コード例 #4
0
ファイル: SemanticAnalyser.cs プロジェクト: kostic017/pigeon
        public override void ExitTernaryExpression([NotNull] PigeonParser.TernaryExpressionContext context)
        {
            CheckExprType(context.expr(0), PigeonType.Bool);
            var whenTrue  = Types.Get(context.expr(1));
            var whenFalse = Types.Get(context.expr(2));

            if (!TernaryOperator.TryGetResType(whenTrue, whenFalse, out var type))
            {
                errorBag.ReportInvalidTypeTernaryOperator(context.GetTextSpan(), whenTrue, whenFalse);
            }
            Types.Put(context, type);
        }
コード例 #5
0
ファイル: IR.cs プロジェクト: nokok/lury
 public TernaryNode(Node x, Node y, Node z, TernaryOperator operation)
 {
     this.x = x;
     this.y = y;
     this.z = z;
     this.operation = operation;
 }