Пример #1
0
 private BoundBinaryOperator(
     SyntaxKind syntaxKind,
     BoundBinaryOperatorKind kind,
     Type type,
     Type resultType
     ) : this(syntaxKind, kind, type, type, resultType)
 {
 }
Пример #2
0
 private BoundBinaryOperator(
     SyntaxKind syntaxKind,
     BoundBinaryOperatorKind kind,
     Type leftType,
     Type rightType,
     Type type
     )
 {
     SyntaxKind = syntaxKind;
     Kind       = kind;
     LeftType   = leftType;
     RightType  = rightType;
     Type       = type;
 }
Пример #3
0
 public static BoundBinaryOperator?Bind(SyntaxKind kind, Type leftType, Type rightType) =>
 _operators.FirstOrDefault(
     op => op.SyntaxKind == kind && op.LeftType == leftType && op.RightType == rightType
     );
Пример #4
0
 public static BoundBinaryOperator BindOrThrow(SyntaxKind kind, Type leftType, Type rightType) =>
 Bind(kind, leftType, rightType) ?? throw new Exception("Binary operator not found");
Пример #5
0
 public static Gen <BoundIfExpression> GenIfExpression(Type type) =>
 from condition in GenBoundExpression(Panther.CodeAnalysis.Symbols.Type.Bool)
 from thenExpr in GenBoundExpression(type)
 from elseExpr in GenBoundExpression(type)
 select new BoundIfExpression(null !, condition, thenExpr, elseExpr);