11private import internal.EdgeKindInternal
22
33private newtype TEdgeKind =
4- TGotoEdge ( ) or // Single successor (including fall-through)
5- TTrueEdge ( ) or // 'true' edge of conditional branch
6- TFalseEdge ( ) or // 'false' edge of conditional branch
7- TExceptionEdge ( ) or // Thrown exception
8- TDefaultEdge ( ) or // 'default' label of switch
9- TCaseEdge ( string minValue , string maxValue ) { // Case label of switch
4+ TGotoEdge ( ) or // Single successor (including fall-through)
5+ TTrueEdge ( ) or // 'true' edge of conditional branch
6+ TFalseEdge ( ) or // 'false' edge of conditional branch
7+ TExceptionEdge ( ) or // Thrown exception
8+ TDefaultEdge ( ) or // 'default' label of switch
9+ TCaseEdge ( string minValue , string maxValue ) {
10+ // Case label of switch
1011 Language:: hasCaseEdge ( minValue , maxValue )
1112 }
1213
@@ -24,99 +25,71 @@ abstract class EdgeKind extends TEdgeKind {
2425 * or `IRBlock`.
2526 */
2627class GotoEdge extends EdgeKind , TGotoEdge {
27- override final string toString ( ) {
28- result = "Goto"
29- }
28+ final override string toString ( ) { result = "Goto" }
3029}
3130
32- GotoEdge gotoEdge ( ) {
33- result = TGotoEdge ( )
34- }
31+ GotoEdge gotoEdge ( ) { result = TGotoEdge ( ) }
3532
3633/**
3734 * A "true" edge, representing the successor of a conditional branch when the
3835 * condition is non-zero.
3936 */
4037class TrueEdge extends EdgeKind , TTrueEdge {
41- override final string toString ( ) {
42- result = "True"
43- }
38+ final override string toString ( ) { result = "True" }
4439}
4540
46- TrueEdge trueEdge ( ) {
47- result = TTrueEdge ( )
48- }
41+ TrueEdge trueEdge ( ) { result = TTrueEdge ( ) }
4942
5043/**
5144 * A "false" edge, representing the successor of a conditional branch when the
5245 * condition is zero.
5346 */
5447class FalseEdge extends EdgeKind , TFalseEdge {
55- override final string toString ( ) {
56- result = "False"
57- }
48+ final override string toString ( ) { result = "False" }
5849}
5950
60- FalseEdge falseEdge ( ) {
61- result = TFalseEdge ( )
62- }
51+ FalseEdge falseEdge ( ) { result = TFalseEdge ( ) }
6352
6453/**
6554 * An "exception" edge, representing the successor of an instruction when that
6655 * instruction's evaluation throws an exception.
6756 */
6857class ExceptionEdge extends EdgeKind , TExceptionEdge {
69- override final string toString ( ) {
70- result = "Exception"
71- }
58+ final override string toString ( ) { result = "Exception" }
7259}
7360
74- ExceptionEdge exceptionEdge ( ) {
75- result = TExceptionEdge ( )
76- }
61+ ExceptionEdge exceptionEdge ( ) { result = TExceptionEdge ( ) }
7762
7863/**
7964 * A "default" edge, representing the successor of a `Switch` instruction when
8065 * none of the case values matches the condition value.
8166 */
8267class DefaultEdge extends EdgeKind , TDefaultEdge {
83- override final string toString ( ) {
84- result = "Default"
85- }
68+ final override string toString ( ) { result = "Default" }
8669}
8770
88- DefaultEdge defaultEdge ( ) {
89- result = TDefaultEdge ( )
90- }
71+ DefaultEdge defaultEdge ( ) { result = TDefaultEdge ( ) }
9172
9273/**
9374 * A "case" edge, representing the successor of a `Switch` instruction when the
9475 * the condition value matches a correponding `case` label.
9576 */
9677class CaseEdge extends EdgeKind , TCaseEdge {
9778 string minValue ;
79+
9880 string maxValue ;
9981
100- CaseEdge ( ) {
101- this = TCaseEdge ( minValue , maxValue )
102- }
82+ CaseEdge ( ) { this = TCaseEdge ( minValue , maxValue ) }
10383
104- override final string toString ( ) {
105- if minValue = maxValue then
106- result = "Case[" + minValue + "]"
107- else
108- result = "Case[" + minValue + ".." + maxValue + "]"
84+ final override string toString ( ) {
85+ if minValue = maxValue
86+ then result = "Case[" + minValue + "]"
87+ else result = "Case[" + minValue + ".." + maxValue + "]"
10988 }
11089
111- string getMinValue ( ) {
112- result = minValue
113- }
90+ string getMinValue ( ) { result = minValue }
11491
115- string getMaxValue ( ) {
116- result = maxValue
117- }
92+ string getMaxValue ( ) { result = maxValue }
11893}
11994
120- CaseEdge caseEdge ( string minValue , string maxValue ) {
121- result = TCaseEdge ( minValue , maxValue )
122- }
95+ CaseEdge caseEdge ( string minValue , string maxValue ) { result = TCaseEdge ( minValue , maxValue ) }
0 commit comments