Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 21203cd

Browse files
committed
C#: Minor code tidy.
1 parent aecc9e2 commit 21203cd

2 files changed

Lines changed: 9 additions & 10 deletions

File tree

  • csharp
    • extractor/Semmle.Extraction.CSharp/Entities/Expressions
    • ql/src/semmle/code/csharp/exprs

csharp/extractor/Semmle.Extraction.CSharp/Entities/Expressions/IsPattern.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ public static Expression CreatePattern(this Context cx, PatternSyntax syntax, IE
5656
default:
5757
throw new InternalError(syntax, "Is pattern not handled");
5858
}
59-
6059
}
6160
}
6261

csharp/ql/src/semmle/code/csharp/exprs/Expr.qll

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -251,8 +251,8 @@ class UncheckedExpr extends Expr, @unchecked_expr {
251251

252252
/**
253253
* An `is` expression.
254-
* Either an `is` type expression (`IsTypeExpr`), an `is` constant expression (`IsConstantExpr`),
255-
* or an `is` recursive pattern expression (`IsPatternExpr`).
254+
* Either an `is` constant expression (`IsConstantExpr`), and `is` pattern expression (`IsPatternExpr`),
255+
* an `is` recursive pattern expression (`IsRecursivePatternExpr`), or an `is` type expression (`IsTypeExpr`).
256256
*/
257257
class IsExpr extends Expr, @is_expr {
258258
/**
@@ -360,7 +360,7 @@ class RecursivePatternExpr extends Expr, @recursive_pattern_expr {
360360
LocalVariableDeclExpr getVariableDeclExpr() { result = this.getChild(0) }
361361
}
362362

363-
/** A property pattern. For example, `{Length: 5}`. */
363+
/** A property pattern. For example, `{ Length: 5 }`. */
364364
class PropertyPatternExpr extends Expr, @property_pattern_expr {
365365
override string toString() { result = "{ ... }" }
366366

@@ -407,7 +407,7 @@ class SwitchCaseExpr extends Expr, @switch_case_expr {
407407

408408
/**
409409
* Gets the `when` expression in a switch arm, if any.
410-
* For example `s.Length<10` in `string s when s.Length<10 => s`.
410+
* For example `s.Length < 10` in `string s when s.Length < 10 => s`.
411411
*/
412412
Expr getCondition() { result = this.getChild(1) }
413413

@@ -419,9 +419,9 @@ class SwitchCaseExpr extends Expr, @switch_case_expr {
419419

420420
/** Holds if this case expression matches all expressions. */
421421
predicate matchesAll() {
422-
// Note: There may be other cases as well.
423-
// For example `(1,2) switch { (int x, int y) => x+y }`
424-
// would match all cases due to the type of the expression.
422+
// Note: There may be other cases that are not yet handled by this predicate.
423+
// For example, `(1,2) switch { (int x, int y) => x+y }`
424+
// should match all cases due to the type of the expression.
425425
getPattern() instanceof DiscardExpr
426426
}
427427
}
@@ -869,10 +869,10 @@ class RangeExpr extends Expr, @range_expr {
869869
Expr getEnd() { result = this.getChild(1) }
870870

871871
/** Holds if this range expression has a left hand operand. */
872-
predicate hasStart() { exists(getStart()) }
872+
predicate hasStart() { exists(this.getStart()) }
873873

874874
/** Holds if this range expression has a right hand operand. */
875-
predicate hasEnd() { exists(getEnd()) }
875+
predicate hasEnd() { exists(this.getEnd()) }
876876
}
877877

878878
/** An index expression, for example `^1` meaning "1 from the end". */

0 commit comments

Comments
 (0)