private BoundBinaryOperator( SyntaxKind syntaxKind, BoundBinaryOperatorKind kind, Type type, Type resultType ) : this(syntaxKind, kind, type, type, resultType) { }
private BoundBinaryOperator( SyntaxKind syntaxKind, BoundBinaryOperatorKind kind, Type leftType, Type rightType, Type type ) { SyntaxKind = syntaxKind; Kind = kind; LeftType = leftType; RightType = rightType; Type = type; }
public static BoundBinaryOperator?Bind(SyntaxKind kind, Type leftType, Type rightType) => _operators.FirstOrDefault( op => op.SyntaxKind == kind && op.LeftType == leftType && op.RightType == rightType );
public static BoundBinaryOperator BindOrThrow(SyntaxKind kind, Type leftType, Type rightType) => Bind(kind, leftType, rightType) ?? throw new Exception("Binary operator not found");
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);