예제 #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);