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

Skip to content

Commit 349e0e8

Browse files
committed
C#: Address more review comments
1 parent 421e75d commit 349e0e8

1 file changed

Lines changed: 28 additions & 8 deletions

File tree

csharp/ql/src/semmle/code/csharp/controlflow/internal/Completion.qll

Lines changed: 28 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -655,8 +655,8 @@ class BreakNormalCompletion extends NormalCompletion, TBreakNormalCompletion {
655655
* }
656656
* ```
657657
*
658-
* `System.Console.WriteLine("M called")` inherits the throw completion
659-
* from `throw new Exception` with an underlying simple completion.
658+
* `System.Console.WriteLine("M called")` has an outer throw completion
659+
* from `throw new Exception` and an inner simple completion.
660660
*/
661661
class NestedCompletion extends Completion, TNestedCompletion {
662662
private NormalCompletion inner;
@@ -682,7 +682,10 @@ class ReturnCompletion extends Completion {
682682
this = TNestedCompletion(_, TReturnCompletion())
683683
}
684684

685-
override string toString() { this = TReturnCompletion() and result = "return" }
685+
override string toString() {
686+
// `NestedCompletion` defines `toString()` for the other case
687+
this = TReturnCompletion() and result = "return"
688+
}
686689
}
687690

688691
/**
@@ -696,7 +699,10 @@ class BreakCompletion extends Completion {
696699
this = TNestedCompletion(_, TBreakCompletion())
697700
}
698701

699-
override string toString() { this = TBreakCompletion() and result = "break" }
702+
override string toString() {
703+
// `NestedCompletion` defines `toString()` for the other case
704+
this = TBreakCompletion() and result = "break"
705+
}
700706
}
701707

702708
/**
@@ -710,7 +716,10 @@ class ContinueCompletion extends Completion {
710716
this = TNestedCompletion(_, TContinueCompletion())
711717
}
712718

713-
override string toString() { this = TContinueCompletion() and result = "continue" }
719+
override string toString() {
720+
// `NestedCompletion` defines `toString()` for the other case
721+
this = TContinueCompletion() and result = "continue"
722+
}
714723
}
715724

716725
/**
@@ -738,6 +747,7 @@ class GotoLabelCompletion extends GotoCompletion {
738747
GotoLabelStmt getGotoStmt() { result = goto }
739748

740749
override string toString() {
750+
// `NestedCompletion` defines `toString()` for the other case
741751
this = TGotoLabelCompletion(goto) and result = "goto(" + this.getLabel() + ")"
742752
}
743753
}
@@ -761,6 +771,7 @@ class GotoCaseCompletion extends GotoCompletion {
761771
GotoCaseStmt getGotoStmt() { result = goto }
762772

763773
override string toString() {
774+
// `NestedCompletion` defines `toString()` for the other case
764775
this = TGotoCaseCompletion(goto) and result = "goto case(" + this.getLabel() + ")"
765776
}
766777
}
@@ -775,7 +786,10 @@ class GotoDefaultCompletion extends GotoCompletion {
775786
this = TNestedCompletion(_, TGotoDefaultCompletion())
776787
}
777788

778-
override string toString() { this = TGotoDefaultCompletion() and result = "goto default" }
789+
override string toString() {
790+
// `NestedCompletion` defines `toString()` for the other case
791+
this = TGotoDefaultCompletion() and result = "goto default"
792+
}
779793
}
780794

781795
/**
@@ -793,7 +807,10 @@ class ThrowCompletion extends Completion {
793807
/** Gets the type of the exception being thrown. */
794808
ExceptionClass getExceptionClass() { result = ec }
795809

796-
override string toString() { this = TThrowCompletion(ec) and result = "throw(" + ec + ")" }
810+
override string toString() {
811+
// `NestedCompletion` defines `toString()` for the other case
812+
this = TThrowCompletion(ec) and result = "throw(" + ec + ")"
813+
}
797814
}
798815

799816
/**
@@ -811,5 +828,8 @@ class ExitCompletion extends Completion {
811828
this = TNestedCompletion(_, TExitCompletion())
812829
}
813830

814-
override string toString() { this = TExitCompletion() and result = "exit" }
831+
override string toString() {
832+
// `NestedCompletion` defines `toString()` for the other case
833+
this = TExitCompletion() and result = "exit"
834+
}
815835
}

0 commit comments

Comments
 (0)