コード例 #1
0
 private Value Or(OrNode exp)
 {
     try
     {
         Constant  left  = Eval(exp.Left).GetRValue();
         Constant  right = Eval(exp.Right).GetRValue();
         BoolValue l     = (BoolValue)Convert(left, Constant.Type.Bool);
         BoolValue r     = (BoolValue)Convert(right, Constant.Type.Bool);
         return(BoolValue.OpOr(l, r));
     }
     catch (TypeConversionError exc)
     {
         throw new ModelInterpreterException($"Операция \"ИЛИ\" не определена для типов \"{exc.Src}\" и \"{exc.Dst}\"")
               {
                   Line     = exp.Line,
                   Position = exp.Position
               };
     }
     catch (Exception exc)
     {
         throw new ModelInterpreterException(exc.Message)
               {
                   Line     = exp.Line,
                   Position = exp.Position
               };
     }
 }