Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions csharp/change-notes/2020-11-19-Relational-pattern.md

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,6 @@ internal static Expression Create(Context cx, PatternSyntax syntax, IExpressionP
case RecursivePatternSyntax recPattern:
return new RecursivePattern(cx, recPattern, parent, child);

case RelationalPatternSyntax relPattern:
return new RelationalPattern(cx, relPattern, parent, child);

case VarPatternSyntax varPattern:
switch (varPattern.Designation)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ internal class RecursivePattern : Expression
/// <param name="syntax">The syntax node of the recursive pattern.</param>
/// <param name="parent">The parent pattern/expression.</param>
/// <param name="child">The child index of this pattern.</param>
/// <param name="isTopLevel">If this pattern is in the top level of a case/is. In that case, the variable and type access are populated elsewhere.</param>
public RecursivePattern(Context cx, RecursivePatternSyntax syntax, IExpressionParentEntity parent, int child) :
base(new ExpressionInfo(cx, Entities.NullType.Create(cx), cx.Create(syntax.GetLocation()), ExprKind.RECURSIVE_PATTERN, parent, child, false, null))
{
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -115,10 +115,6 @@ public enum ExprKind
SWITCH_CASE = 118,
ASSIGN_COALESCE = 119,
SUPPRESS_NULLABLE_WARNING = 120,
NAMESPACE_ACCESS = 121,
LT_PATTERN = 122,
GT_PATTERN = 123,
LE_PATTERN = 124,
GE_PATTERN = 125,
NAMESPACE_ACCESS = 121
}
}
39 changes: 0 additions & 39 deletions csharp/ql/src/semmle/code/csharp/exprs/Expr.qll
Original file line number Diff line number Diff line change
Expand Up @@ -342,45 +342,6 @@ class ConstantPatternExpr extends PatternExpr {
override string getAPrimaryQlClass() { result = "ConstantPatternExpr" }
}

/** A relational pattern, for example `>1` in `x is >1`. */
class RelationalPatternExpr extends PatternExpr, @relational_pattern_expr {
/** Gets the name of the operator in this pattern. */
string getOperator() { none() }

/** Gets the expression of this relational pattern. */
Expr getExpr() { result = this.getChild(0) }

override string toString() { result = getOperator() + " ..." }
}

/** A less-than pattern, for example `< 10` in `x is < 10`. */
class LTPattern extends RelationalPatternExpr, @lt_pattern_expr {
override string getOperator() { result = "<" }

override string getAPrimaryQlClass() { result = "LTPattern" }
}

/** A greater-than pattern, for example `> 10` in `x is > 10`. */
class GTPattern extends RelationalPatternExpr, @gt_pattern_expr {
override string getOperator() { result = ">" }

override string getAPrimaryQlClass() { result = "GTPattern" }
}

/** A less-than or equals pattern, for example `<= 10` in `x is <= 10`. */
class LEPattern extends RelationalPatternExpr, @le_pattern_expr {
override string getOperator() { result = "<=" }

override string getAPrimaryQlClass() { result = "LEPattern" }
}

/** A greater-than or equals pattern, for example `>= 10` in `x is >= 10` */
class GEPattern extends RelationalPatternExpr, @ge_pattern_expr {
override string getOperator() { result = ">=" }

override string getAPrimaryQlClass() { result = "GEPattern" }
}

/**
* A type pattern, for example `string` in `x is string`, `string s` in
* `x is string s`, or `string _` in `x is string _`.
Expand Down
6 changes: 0 additions & 6 deletions csharp/ql/src/semmlecode.csharp.dbscheme
Original file line number Diff line number Diff line change
Expand Up @@ -998,17 +998,11 @@ case @expr.kind of
| 119 = @assign_coalesce_expr
| 120 = @suppress_nullable_warning_expr
| 121 = @namespace_access_expr
/* C# 9.0 */
| 122 = @lt_pattern_expr
| 123 = @gt_pattern_expr
| 124 = @le_pattern_expr
| 125 = @ge_pattern_expr
;

@switch = @switch_stmt | @switch_expr;
@case = @case_stmt | @switch_case_expr;
@pattern_match = @case | @is_expr;
@relational_pattern_expr = @gt_pattern_expr | @lt_pattern_expr | @ge_pattern_expr | @le_pattern_expr;

@integer_literal_expr = @int_literal_expr | @long_literal_expr | @uint_literal_expr | @ulong_literal_expr;
@real_literal_expr = @float_literal_expr | @double_literal_expr | @decimal_literal_expr;
Expand Down
57 changes: 0 additions & 57 deletions csharp/ql/test/library-tests/csharp9/PrintAst.expected
Original file line number Diff line number Diff line change
Expand Up @@ -335,63 +335,6 @@ ParenthesizedPattern.cs:
# 27| 0: [TypeAccessPatternExpr] access to type String
# 27| 0: [TypeMention] string
# 27| 2: [IntLiteral] 5
RelationalPattern.cs:
# 3| [Class] RelationalPattern
# 5| 5: [Method] M1
# 5| -1: [TypeMention] bool
#-----| 2: (Parameters)
# 5| 0: [Parameter] c
# 5| -1: [TypeMention] char
# 6| 4: [IsExpr] ... is ...
# 6| 0: [ParameterAccess] access to parameter c
# 6| 1: [GEPattern] >= ...
# 6| 0: [CharLiteral] a
# 7| 6: [Method] M2
# 7| -1: [TypeMention] bool
#-----| 2: (Parameters)
# 7| 0: [Parameter] c
# 7| -1: [TypeMention] char
# 8| 4: [IsExpr] ... is ...
# 8| 0: [ParameterAccess] access to parameter c
# 8| 1: [GTPattern] > ...
# 8| 0: [CharLiteral] a
# 9| 7: [Method] M3
# 9| -1: [TypeMention] bool
#-----| 2: (Parameters)
# 9| 0: [Parameter] c
# 9| -1: [TypeMention] char
# 10| 4: [IsExpr] ... is ...
# 10| 0: [ParameterAccess] access to parameter c
# 10| 1: [LEPattern] <= ...
# 10| 0: [CharLiteral] a
# 11| 8: [Method] M4
# 11| -1: [TypeMention] bool
#-----| 2: (Parameters)
# 11| 0: [Parameter] c
# 11| -1: [TypeMention] char
# 12| 4: [IsExpr] ... is ...
# 12| 0: [ParameterAccess] access to parameter c
# 12| 1: [LTPattern] < ...
# 12| 0: [CharLiteral] a
# 14| 9: [Method] M5
# 14| -1: [TypeMention] string
#-----| 2: (Parameters)
# 14| 0: [Parameter] i
# 14| -1: [TypeMention] int
# 15| 4: [BlockStmt] {...}
# 16| 0: [ReturnStmt] return ...;
# 16| 0: [SwitchExpr] ... switch { ... }
# 16| -1: [ParameterAccess] access to parameter i
# 18| 0: [SwitchCaseExpr] ... => ...
# 18| 0: [ConstantPatternExpr,IntLiteral] 1
# 18| 2: [StringLiteral] "1"
# 19| 1: [SwitchCaseExpr] ... => ...
# 19| 0: [GTPattern] > ...
# 19| 0: [IntLiteral] 1
# 19| 2: [StringLiteral] ">1"
# 20| 2: [SwitchCaseExpr] ... => ...
# 20| 0: [DiscardPatternExpr] _
# 20| 2: [StringLiteral] "other"
TargetType.cs:
# 5| [Class] TargetType
# 7| 5: [Method] M2
Expand Down
23 changes: 0 additions & 23 deletions csharp/ql/test/library-tests/csharp9/RelationalPattern.cs

This file was deleted.

This file was deleted.

4 changes: 0 additions & 4 deletions csharp/ql/test/library-tests/csharp9/relationalPattern.ql

This file was deleted.

Loading