@@ -73,10 +73,10 @@ class BlockStmt extends Stmt, @block {
73
73
/** Gets the last statement in this block. */
74
74
Stmt getLastStmt ( ) { result = getStmt ( getNumStmt ( ) - 1 ) }
75
75
76
- /** Gets a printable representation of this statement. May include more detail than `toString()`. */
77
76
override string pp ( ) { result = "{ ... }" }
78
77
79
- /** This statement's Halstead ID (used to compute Halstead metrics). */
78
+ override string toString ( ) { result = "{ ... }" }
79
+
80
80
override string getHalsteadID ( ) { result = "BlockStmt" }
81
81
82
82
override string getAPrimaryQlClass ( ) { result = "BlockStmt" }
@@ -130,14 +130,14 @@ class IfStmt extends ConditionalStmt, @ifstmt {
130
130
/** Gets the `else` branch of this `if` statement. */
131
131
Stmt getElse ( ) { result .isNthChildOf ( this , 2 ) }
132
132
133
- /** Gets a printable representation of this statement. May include more detail than `toString()`. */
134
133
override string pp ( ) {
135
134
result = "if (...) " + this .getThen ( ) .pp ( ) + " else " + this .getElse ( ) .pp ( )
136
135
or
137
136
not exists ( this .getElse ( ) ) and result = "if (...) " + this .getThen ( ) .pp ( )
138
137
}
139
138
140
- /** This statement's Halstead ID (used to compute Halstead metrics). */
139
+ override string toString ( ) { result = "if (...)" }
140
+
141
141
override string getHalsteadID ( ) { result = "IfStmt" }
142
142
143
143
override string getAPrimaryQlClass ( ) { result = "IfStmt" }
@@ -201,10 +201,10 @@ class ForStmt extends ConditionalStmt, @forstmt {
201
201
getCondition ( ) .getAChildExpr * ( ) = result .getAnAccess ( )
202
202
}
203
203
204
- /** Gets a printable representation of this statement. May include more detail than `toString()`. */
205
204
override string pp ( ) { result = "for (...;...;...) " + this .getStmt ( ) .pp ( ) }
206
205
207
- /** This statement's Halstead ID (used to compute Halstead metrics). */
206
+ override string toString ( ) { result = "for (...;...;...)" }
207
+
208
208
override string getHalsteadID ( ) { result = "ForStmt" }
209
209
210
210
override string getAPrimaryQlClass ( ) { result = "ForStmt" }
@@ -221,10 +221,10 @@ class EnhancedForStmt extends Stmt, @enhancedforstmt {
221
221
/** Gets the body of this enhanced `for` loop. */
222
222
Stmt getStmt ( ) { result .getParent ( ) = this }
223
223
224
- /** Gets a printable representation of this statement. May include more detail than `toString()`. */
225
- override string pp ( ) { result = "for (...) " + this .getStmt ( ) .pp ( ) }
224
+ override string pp ( ) { result = "for (... : ...) " + this .getStmt ( ) .pp ( ) }
225
+
226
+ override string toString ( ) { result = "for (... : ...)" }
226
227
227
- /** This statement's Halstead ID (used to compute Halstead metrics). */
228
228
override string getHalsteadID ( ) { result = "EnhancedForStmt" }
229
229
230
230
override string getAPrimaryQlClass ( ) { result = "EnhancedForStmt" }
@@ -244,10 +244,10 @@ class WhileStmt extends ConditionalStmt, @whilestmt {
244
244
*/
245
245
deprecated override Stmt getTrueSuccessor ( ) { result = getStmt ( ) }
246
246
247
- /** Gets a printable representation of this statement. May include more detail than `toString()`. */
248
247
override string pp ( ) { result = "while (...) " + this .getStmt ( ) .pp ( ) }
249
248
250
- /** This statement's Halstead ID (used to compute Halstead metrics). */
249
+ override string toString ( ) { result = "while (...)" }
250
+
251
251
override string getHalsteadID ( ) { result = "WhileStmt" }
252
252
253
253
override string getAPrimaryQlClass ( ) { result = "WhileStmt" }
@@ -267,10 +267,10 @@ class DoStmt extends ConditionalStmt, @dostmt {
267
267
*/
268
268
deprecated override Stmt getTrueSuccessor ( ) { result = getStmt ( ) }
269
269
270
- /** Gets a printable representation of this statement. May include more detail than `toString()`. */
271
270
override string pp ( ) { result = "do " + this .getStmt ( ) .pp ( ) + " while (...)" }
272
271
273
- /** This statement's Halstead ID (used to compute Halstead metrics). */
272
+ override string toString ( ) { result = "do ... while (...)" }
273
+
274
274
override string getHalsteadID ( ) { result = "DoStmt" }
275
275
276
276
override string getAPrimaryQlClass ( ) { result = "DoStmt" }
@@ -356,10 +356,10 @@ class TryStmt extends Stmt, @trystmt {
356
356
result = getAResourceExpr ( ) .getVariable ( )
357
357
}
358
358
359
- /** Gets a printable representation of this statement. May include more detail than `toString()`. */
360
359
override string pp ( ) { result = "try " + this .getBlock ( ) .pp ( ) + " catch (...)" }
361
360
362
- /** This statement's Halstead ID (used to compute Halstead metrics). */
361
+ override string toString ( ) { result = "try ..." }
362
+
363
363
override string getHalsteadID ( ) { result = "TryStmt" }
364
364
365
365
override string getAPrimaryQlClass ( ) { result = "TryStmt" }
@@ -387,10 +387,10 @@ class CatchClause extends Stmt, @catchclause {
387
387
)
388
388
}
389
389
390
- /** Gets a printable representation of this statement. May include more detail than `toString()`. */
391
390
override string pp ( ) { result = "catch (...) " + this .getBlock ( ) .pp ( ) }
392
391
393
- /** This statement's Halstead ID (used to compute Halstead metrics). */
392
+ override string toString ( ) { result = "catch (...)" }
393
+
394
394
override string getHalsteadID ( ) { result = "CatchClause" }
395
395
396
396
override string getAPrimaryQlClass ( ) { result = "CatchClause" }
@@ -422,10 +422,10 @@ class SwitchStmt extends Stmt, @switchstmt {
422
422
/** Gets the expression of this `switch` statement. */
423
423
Expr getExpr ( ) { result .getParent ( ) = this }
424
424
425
- /** Gets a printable representation of this statement. May include more detail than `toString()`. */
426
425
override string pp ( ) { result = "switch (...)" }
427
426
428
- /** This statement's Halstead ID (used to compute Halstead metrics). */
427
+ override string toString ( ) { result = "switch (...)" }
428
+
429
429
override string getHalsteadID ( ) { result = "SwitchStmt" }
430
430
431
431
override string getAPrimaryQlClass ( ) { result = "SwitchStmt" }
@@ -485,10 +485,10 @@ class ConstCase extends SwitchCase {
485
485
*/
486
486
Expr getValue ( int i ) { result .getParent ( ) = this and result .getIndex ( ) = i and i >= 0 }
487
487
488
- /** Gets a printable representation of this statement. May include more detail than `toString()`. */
489
488
override string pp ( ) { result = "case ..." }
490
489
491
- /** This statement's Halstead ID (used to compute Halstead metrics). */
490
+ override string toString ( ) { result = "case ..." }
491
+
492
492
override string getHalsteadID ( ) { result = "ConstCase" }
493
493
494
494
override string getAPrimaryQlClass ( ) { result = "ConstCase" }
@@ -498,10 +498,10 @@ class ConstCase extends SwitchCase {
498
498
class DefaultCase extends SwitchCase {
499
499
DefaultCase ( ) { not exists ( Expr e | e .getParent ( ) = this | e .getIndex ( ) >= 0 ) }
500
500
501
- /** Gets a printable representation of this statement. May include more detail than `toString()`. */
502
501
override string pp ( ) { result = "default" }
503
502
504
- /** This statement's Halstead ID (used to compute Halstead metrics). */
503
+ override string toString ( ) { result = "default" }
504
+
505
505
override string getHalsteadID ( ) { result = "DefaultCase" }
506
506
507
507
override string getAPrimaryQlClass ( ) { result = "DefaultCase" }
@@ -515,10 +515,10 @@ class SynchronizedStmt extends Stmt, @synchronizedstmt {
515
515
/** Gets the block of this `synchronized` statement. */
516
516
Stmt getBlock ( ) { result .getParent ( ) = this }
517
517
518
- /** Gets a printable representation of this statement. May include more detail than `toString()`. */
519
518
override string pp ( ) { result = "synchronized (...) " + this .getBlock ( ) .pp ( ) }
520
519
521
- /** This statement's Halstead ID (used to compute Halstead metrics). */
520
+ override string toString ( ) { result = "synchronized (...)" }
521
+
522
522
override string getHalsteadID ( ) { result = "SynchronizedStmt" }
523
523
524
524
override string getAPrimaryQlClass ( ) { result = "SynchronizedStmt" }
@@ -529,10 +529,10 @@ class ReturnStmt extends Stmt, @returnstmt {
529
529
/** Gets the expression returned by this `return` statement, if any. */
530
530
Expr getResult ( ) { result .getParent ( ) = this }
531
531
532
- /** Gets a printable representation of this statement. May include more detail than `toString()`. */
533
532
override string pp ( ) { result = "return ..." }
534
533
535
- /** This statement's Halstead ID (used to compute Halstead metrics). */
534
+ override string toString ( ) { result = "return ..." }
535
+
536
536
override string getHalsteadID ( ) { result = "ReturnStmt" }
537
537
538
538
override string getAPrimaryQlClass ( ) { result = "ReturnStmt" }
@@ -543,10 +543,10 @@ class ThrowStmt extends Stmt, @throwstmt {
543
543
/** Gets the expression thrown by this `throw` statement. */
544
544
Expr getExpr ( ) { result .getParent ( ) = this }
545
545
546
- /** Gets a printable representation of this statement. May include more detail than `toString()`. */
547
546
override string pp ( ) { result = "throw ..." }
548
547
549
- /** This statement's Halstead ID (used to compute Halstead metrics). */
548
+ override string toString ( ) { result = "throw ..." }
549
+
550
550
override string getHalsteadID ( ) { result = "ThrowStmt" }
551
551
552
552
/** Gets the type of the expression thrown by this `throw` statement. */
@@ -638,12 +638,12 @@ class BreakStmt extends Stmt, @breakstmt {
638
638
/** Holds if this `break` statement has an explicit label. */
639
639
predicate hasLabel ( ) { exists ( string s | s = this .getLabel ( ) ) }
640
640
641
- /** Gets a printable representation of this statement. May include more detail than `toString()`. */
642
641
override string pp ( ) {
643
642
if this .hasLabel ( ) then result = "break " + this .getLabel ( ) else result = "break"
644
643
}
645
644
646
- /** This statement's Halstead ID (used to compute Halstead metrics). */
645
+ override string toString ( ) { result = "break" }
646
+
647
647
override string getHalsteadID ( ) { result = "BreakStmt" }
648
648
649
649
override string getAPrimaryQlClass ( ) { result = "BreakStmt" }
@@ -660,6 +660,8 @@ class YieldStmt extends Stmt, @yieldstmt {
660
660
661
661
override string pp ( ) { result = "yield ..." }
662
662
663
+ override string toString ( ) { result = "yield ..." }
664
+
663
665
override string getHalsteadID ( ) { result = "YieldStmt" }
664
666
665
667
override string getAPrimaryQlClass ( ) { result = "YieldStmt" }
@@ -673,23 +675,23 @@ class ContinueStmt extends Stmt, @continuestmt {
673
675
/** Holds if this `continue` statement has an explicit label. */
674
676
predicate hasLabel ( ) { exists ( string s | s = this .getLabel ( ) ) }
675
677
676
- /** Gets a printable representation of this statement. May include more detail than `toString()`. */
677
678
override string pp ( ) {
678
679
if this .hasLabel ( ) then result = "continue " + this .getLabel ( ) else result = "continue"
679
680
}
680
681
681
- /** This statement's Halstead ID (used to compute Halstead metrics). */
682
+ override string toString ( ) { result = "continue" }
683
+
682
684
override string getHalsteadID ( ) { result = "ContinueStmt" }
683
685
684
686
override string getAPrimaryQlClass ( ) { result = "ContinueStmt" }
685
687
}
686
688
687
689
/** The empty statement. */
688
690
class EmptyStmt extends Stmt , @emptystmt {
689
- /** Gets a printable representation of this statement. May include more detail than `toString()`. */
690
691
override string pp ( ) { result = ";" }
691
692
692
- /** This statement's Halstead ID (used to compute Halstead metrics). */
693
+ override string toString ( ) { result = ";" }
694
+
693
695
override string getHalsteadID ( ) { result = "EmptyStmt" }
694
696
695
697
override string getAPrimaryQlClass ( ) { result = "EmptyStmt" }
@@ -704,10 +706,10 @@ class ExprStmt extends Stmt, @exprstmt {
704
706
/** Gets the expression of this expression statement. */
705
707
Expr getExpr ( ) { result .getParent ( ) = this }
706
708
707
- /** Gets a printable representation of this statement. May include more detail than `toString()`. */
708
- override string pp ( ) { result = "...;" }
709
+ override string pp ( ) { result = "<Expr>;" }
710
+
711
+ override string toString ( ) { result = "<Expr>;" }
709
712
710
- /** This statement's Halstead ID (used to compute Halstead metrics). */
711
713
override string getHalsteadID ( ) { result = "ExprStmt" }
712
714
713
715
/** Holds if this statement represents a field declaration with an initializer. */
@@ -733,12 +735,12 @@ class LabeledStmt extends Stmt, @labeledstmt {
733
735
/** Gets the label of this labeled statement. */
734
736
string getLabel ( ) { namestrings ( result , _, this ) }
735
737
736
- /** Gets a printable representation of this statement. May include more detail than `toString()`. */
737
738
override string pp ( ) { result = this .getLabel ( ) + ": " + this .getStmt ( ) .pp ( ) }
738
739
739
- /** This statement's Halstead ID (used to compute Halstead metrics). */
740
740
override string getHalsteadID ( ) { result = this .getLabel ( ) + ":" }
741
741
742
+ override string toString ( ) { result = "<Label>: ..." }
743
+
742
744
override string getAPrimaryQlClass ( ) { result = "LabeledStmt" }
743
745
}
744
746
@@ -750,12 +752,12 @@ class AssertStmt extends Stmt, @assertstmt {
750
752
/** Gets the assertion message expression, if any. */
751
753
Expr getMessage ( ) { exprs ( result , _, _, this , _) and result .getIndex ( ) = 1 }
752
754
753
- /** Gets a printable representation of this statement. May include more detail than `toString()`. */
754
755
override string pp ( ) {
755
756
if exists ( this .getMessage ( ) ) then result = "assert ... : ..." else result = "assert ..."
756
757
}
757
758
758
- /** This statement's Halstead ID (used to compute Halstead metrics). */
759
+ override string toString ( ) { result = "assert ..." }
760
+
759
761
override string getHalsteadID ( ) { result = "AssertStmt" }
760
762
761
763
override string getAPrimaryQlClass ( ) { result = "AssertStmt" }
@@ -775,10 +777,10 @@ class LocalVariableDeclStmt extends Stmt, @localvariabledeclstmt {
775
777
/** Gets an index of a variable declared in this local variable declaration statement. */
776
778
int getAVariableIndex ( ) { exists ( getVariable ( result ) ) }
777
779
778
- /** Gets a printable representation of this statement. May include more detail than `toString()`. */
779
- override string pp ( ) { result = "local variable declaration" }
780
+ override string pp ( ) { result = "var ...;" }
781
+
782
+ override string toString ( ) { result = "var ...;" }
780
783
781
- /** This statement's Halstead ID (used to compute Halstead metrics). */
782
784
override string getHalsteadID ( ) { result = "LocalVariableDeclStmt" }
783
785
784
786
override string getAPrimaryQlClass ( ) { result = "LocalVariableDeclStmt" }
@@ -789,10 +791,10 @@ class LocalClassDeclStmt extends Stmt, @localclassdeclstmt {
789
791
/** Gets the local class declared by this statement. */
790
792
LocalClass getLocalClass ( ) { isLocalClass ( result , this ) }
791
793
792
- /** Gets a printable representation of this statement. May include more detail than `toString()`. */
793
- override string pp ( ) { result = "local class declaration: " + this .getLocalClass ( ) .toString ( ) }
794
+ override string pp ( ) { result = "class " + this .getLocalClass ( ) .toString ( ) }
795
+
796
+ override string toString ( ) { result = "class ..." }
794
797
795
- /** This statement's Halstead ID (used to compute Halstead metrics). */
796
798
override string getHalsteadID ( ) { result = "LocalClassDeclStmt" }
797
799
798
800
override string getAPrimaryQlClass ( ) { result = "LocalClassDeclStmt" }
@@ -829,13 +831,10 @@ class ThisConstructorInvocationStmt extends Stmt, ConstructorCall, @constructori
829
831
/** Gets the immediately enclosing statement of this constructor invocation. */
830
832
override Stmt getEnclosingStmt ( ) { result = this }
831
833
832
- /** Gets a printable representation of this statement. May include more detail than `toString()`. */
833
834
override string pp ( ) { result = "this(...)" }
834
835
835
- /** Gets a printable representation of this statement. */
836
- override string toString ( ) { result = pp ( ) }
836
+ override string toString ( ) { result = "this(...)" }
837
837
838
- /** This statement's Halstead ID (used to compute Halstead metrics). */
839
838
override string getHalsteadID ( ) { result = "ConstructorInvocationStmt" }
840
839
841
840
override string getAPrimaryQlClass ( ) { result = "ThisConstructorInvocationStmt" }
@@ -873,13 +872,10 @@ class SuperConstructorInvocationStmt extends Stmt, ConstructorCall, @superconstr
873
872
/** Gets the immediately enclosing statement of this constructor invocation. */
874
873
override Stmt getEnclosingStmt ( ) { result = this }
875
874
876
- /** Gets a printable representation of this statement. May include more detail than `toString()`. */
877
875
override string pp ( ) { result = "super(...)" }
878
876
879
- /** Gets a printable representation of this statement. */
880
- override string toString ( ) { result = pp ( ) }
877
+ override string toString ( ) { result = "super(...)" }
881
878
882
- /** This statement's Halstead ID (used to compute Halstead metrics). */
883
879
override string getHalsteadID ( ) { result = "SuperConstructorInvocationStmt" }
884
880
885
881
override string getAPrimaryQlClass ( ) { result = "SuperConstructorInvocationStmt" }
0 commit comments