@@ -171,6 +171,9 @@ abstract class EssaDefinition extends TEssaDefinition {
171
171
EssaVariable getVariable ( ) { result .getDefinition ( ) = this }
172
172
173
173
abstract BasicBlock getBasicBlock ( ) ;
174
+
175
+ /** Gets the name of the primary QL class for this element. */
176
+ string getAPrimaryQlClass ( ) { result = "EssaDefinition" }
174
177
}
175
178
176
179
/**
@@ -216,13 +219,15 @@ class EssaEdgeRefinement extends EssaDefinition, TEssaEdgeDefinition {
216
219
}
217
220
218
221
override string getRepresentation ( ) {
219
- result = this .getAQlClass ( ) + "(" + this .getInput ( ) .getRepresentation ( ) + ")"
222
+ result = this .getAPrimaryQlClass ( ) + "(" + this .getInput ( ) .getRepresentation ( ) + ")"
220
223
}
221
224
222
225
/** Gets the scope of the variable defined by this definition. */
223
226
override Scope getScope ( ) { result = this .getPredecessor ( ) .getScope ( ) }
224
227
225
228
override BasicBlock getBasicBlock ( ) { result = this .getSuccessor ( ) }
229
+
230
+ override string getAPrimaryQlClass ( ) { result = "EssaEdgeRefinement" }
226
231
}
227
232
228
233
/** A Phi-function as specified in classic SSA form. */
@@ -366,6 +371,8 @@ class PhiFunction extends EssaDefinition, TPhiFunction {
366
371
)
367
372
)
368
373
}
374
+
375
+ override string getAPrimaryQlClass ( ) { result = "PhiFunction" }
369
376
}
370
377
371
378
/**
@@ -396,7 +403,7 @@ class EssaNodeDefinition extends EssaDefinition, TEssaNodeDefinition {
396
403
397
404
override Location getLocation ( ) { result = this .getDefiningNode ( ) .getLocation ( ) }
398
405
399
- override string getRepresentation ( ) { result = this .getAQlClass ( ) }
406
+ override string getRepresentation ( ) { result = this .getAPrimaryQlClass ( ) }
400
407
401
408
override Scope getScope ( ) {
402
409
exists ( BasicBlock defb |
@@ -414,6 +421,8 @@ class EssaNodeDefinition extends EssaDefinition, TEssaNodeDefinition {
414
421
}
415
422
416
423
override BasicBlock getBasicBlock ( ) { result = this .getDefiningNode ( ) .getBasicBlock ( ) }
424
+
425
+ override string getAPrimaryQlClass ( ) { result = "EssaNodeDefinition" }
417
426
}
418
427
419
428
/** A definition of an ESSA variable that takes another ESSA variable as an input. */
@@ -448,10 +457,10 @@ class EssaNodeRefinement extends EssaDefinition, TEssaNodeRefinement {
448
457
override Location getLocation ( ) { result = this .getDefiningNode ( ) .getLocation ( ) }
449
458
450
459
override string getRepresentation ( ) {
451
- result = this .getAQlClass ( ) + "(" + this .getInput ( ) .getRepresentation ( ) + ")"
460
+ result = this .getAPrimaryQlClass ( ) + "(" + this .getInput ( ) .getRepresentation ( ) + ")"
452
461
or
453
462
not exists ( this .getInput ( ) ) and
454
- result = this .getAQlClass ( ) + "(" + this .getSourceVariable ( ) .getName ( ) + "??)"
463
+ result = this .getAPrimaryQlClass ( ) + "(" + this .getSourceVariable ( ) .getName ( ) + "??)"
455
464
}
456
465
457
466
override Scope getScope ( ) {
@@ -470,6 +479,8 @@ class EssaNodeRefinement extends EssaDefinition, TEssaNodeRefinement {
470
479
}
471
480
472
481
override BasicBlock getBasicBlock ( ) { result = this .getDefiningNode ( ) .getBasicBlock ( ) }
482
+
483
+ override string getAPrimaryQlClass ( ) { result = "EssaNodeRefinement" }
473
484
}
474
485
475
486
pragma [ noopt]
@@ -500,6 +511,8 @@ class AssignmentDefinition extends EssaNodeDefinition {
500
511
}
501
512
502
513
override string getRepresentation ( ) { result = this .getValue ( ) .getNode ( ) .toString ( ) }
514
+
515
+ override string getAPrimaryQlClass ( ) { result = "AssignmentDefinition" }
503
516
}
504
517
505
518
/** Capture of a raised exception `except ExceptionType ex:` */
@@ -516,6 +529,8 @@ class ExceptionCapture extends EssaNodeDefinition {
516
529
}
517
530
518
531
override string getRepresentation ( ) { result = "except " + this .getSourceVariable ( ) .getName ( ) }
532
+
533
+ override string getAPrimaryQlClass ( ) { result = "ExceptionCapture" }
519
534
}
520
535
521
536
/** An assignment to a variable as part of a multiple assignment `..., v, ... = val` */
@@ -536,13 +551,17 @@ class MultiAssignmentDefinition extends EssaNodeDefinition {
536
551
SsaSource:: multi_assignment_definition ( this .getSourceVariable ( ) , this .getDefiningNode ( ) , index ,
537
552
lhs )
538
553
}
554
+
555
+ override string getAPrimaryQlClass ( ) { result = "MultiAssignmentDefinition" }
539
556
}
540
557
541
558
/** A definition of a variable in a `with` statement */
542
559
class WithDefinition extends EssaNodeDefinition {
543
560
WithDefinition ( ) { SsaSource:: with_definition ( this .getSourceVariable ( ) , this .getDefiningNode ( ) ) }
544
561
545
562
override string getRepresentation ( ) { result = "with" }
563
+
564
+ override string getAPrimaryQlClass ( ) { result = "WithDefinition" }
546
565
}
547
566
548
567
/** A definition of a variable via a capture pattern */
@@ -552,6 +571,8 @@ class PatternCaptureDefinition extends EssaNodeDefinition {
552
571
}
553
572
554
573
override string getRepresentation ( ) { result = "pattern capture" }
574
+
575
+ override string getAPrimaryQlClass ( ) { result = "PatternCaptureDefinition" }
555
576
}
556
577
557
578
/** A definition of a variable via a pattern alias */
@@ -561,6 +582,8 @@ class PatternAliasDefinition extends EssaNodeDefinition {
561
582
}
562
583
563
584
override string getRepresentation ( ) { result = "pattern alias" }
585
+
586
+ override string getAPrimaryQlClass ( ) { result = "PatternAliasDefinition" }
564
587
}
565
588
566
589
/** A definition of a variable by declaring it as a parameter */
@@ -594,13 +617,17 @@ class ParameterDefinition extends EssaNodeDefinition {
594
617
595
618
/** Gets the `Parameter` this `ParameterDefinition` represents. */
596
619
Parameter getParameter ( ) { result = this .getDefiningNode ( ) .getNode ( ) }
620
+
621
+ override string getAPrimaryQlClass ( ) { result = "ParameterDefinition" }
597
622
}
598
623
599
624
/** A deletion of a variable `del v` */
600
625
class DeletionDefinition extends EssaNodeDefinition {
601
626
DeletionDefinition ( ) {
602
627
SsaSource:: deletion_definition ( this .getSourceVariable ( ) , this .getDefiningNode ( ) )
603
628
}
629
+
630
+ override string getAPrimaryQlClass ( ) { result = "DeletionDefinition" }
604
631
}
605
632
606
633
/**
@@ -614,13 +641,17 @@ class ScopeEntryDefinition extends EssaNodeDefinition {
614
641
}
615
642
616
643
override Scope getScope ( ) { result .getEntryNode ( ) = this .getDefiningNode ( ) }
644
+
645
+ override string getAPrimaryQlClass ( ) { result = "ScopeEntryDefinition" }
617
646
}
618
647
619
648
/** Possible redefinition of variable via `from ... import *` */
620
649
class ImportStarRefinement extends EssaNodeRefinement {
621
650
ImportStarRefinement ( ) {
622
651
SsaSource:: import_star_refinement ( this .getSourceVariable ( ) , _, this .getDefiningNode ( ) )
623
652
}
653
+
654
+ override string getAPrimaryQlClass ( ) { result = "ImportStarRefinement" }
624
655
}
625
656
626
657
/** Assignment of an attribute `obj.attr = val` */
@@ -635,12 +666,16 @@ class AttributeAssignment extends EssaNodeRefinement {
635
666
636
667
override string getRepresentation ( ) {
637
668
result =
638
- this .getAQlClass ( ) + " '" + this .getName ( ) + "'(" + this .getInput ( ) .getRepresentation ( ) + ")"
669
+ this .getAPrimaryQlClass ( ) + " '" + this .getName ( ) + "'(" + this .getInput ( ) .getRepresentation ( )
670
+ + ")"
639
671
or
640
672
not exists ( this .getInput ( ) ) and
641
673
result =
642
- this .getAQlClass ( ) + " '" + this .getName ( ) + "'(" + this .getSourceVariable ( ) .getName ( ) + "??)"
674
+ this .getAPrimaryQlClass ( ) + " '" + this .getName ( ) + "'(" + this .getSourceVariable ( ) .getName ( ) +
675
+ "??)"
643
676
}
677
+
678
+ override string getAPrimaryQlClass ( ) { result = "AttributeAssignment" }
644
679
}
645
680
646
681
/** A use of a variable as an argument, `foo(v)`, which might modify the object referred to. */
@@ -654,6 +689,8 @@ class ArgumentRefinement extends EssaNodeRefinement {
654
689
ControlFlowNode getArgument ( ) { result = argument }
655
690
656
691
CallNode getCall ( ) { result = this .getDefiningNode ( ) }
692
+
693
+ override string getAPrimaryQlClass ( ) { result = "ArgumentRefinement" }
657
694
}
658
695
659
696
/** Deletion of an attribute `del obj.attr`. */
@@ -663,6 +700,8 @@ class EssaAttributeDeletion extends EssaNodeRefinement {
663
700
}
664
701
665
702
string getName ( ) { result = this .getDefiningNode ( ) .( AttrNode ) .getName ( ) }
703
+
704
+ override string getAPrimaryQlClass ( ) { result = "EssaAttributeDeletion" }
666
705
}
667
706
668
707
/** A pi-node (guard) with only one successor. */
@@ -690,6 +729,8 @@ class SingleSuccessorGuard extends EssaNodeRefinement {
690
729
test = this .getDefiningNode ( ) and
691
730
SsaSource:: test_refinement ( this .getSourceVariable ( ) , use , test )
692
731
}
732
+
733
+ override string getAPrimaryQlClass ( ) { result = "SingleSuccessorGuard" }
693
734
}
694
735
695
736
/**
@@ -701,11 +742,13 @@ class ImplicitSubModuleDefinition extends EssaNodeDefinition {
701
742
ImplicitSubModuleDefinition ( ) {
702
743
SsaSource:: init_module_submodule_defn ( this .getSourceVariable ( ) , this .getDefiningNode ( ) )
703
744
}
745
+
746
+ override string getAPrimaryQlClass ( ) { result = "ImplicitSubModuleDefinition" }
704
747
}
705
748
706
749
/** An implicit (possible) definition of an escaping variable at a call-site */
707
750
class CallsiteRefinement extends EssaNodeRefinement {
708
- override string toString ( ) { result = "CallsiteRefinement " }
751
+ override string toString ( ) { result = "CallSiteRefinement " }
709
752
710
753
CallsiteRefinement ( ) {
711
754
exists ( SsaSourceVariable var , ControlFlowNode defn |
@@ -718,6 +761,8 @@ class CallsiteRefinement extends EssaNodeRefinement {
718
761
}
719
762
720
763
CallNode getCall ( ) { this .getDefiningNode ( ) = result }
764
+
765
+ override string getAPrimaryQlClass ( ) { result = "CallsiteRefinement" }
721
766
}
722
767
723
768
/** An implicit (possible) modification of the object referred at a method call */
@@ -728,11 +773,15 @@ class MethodCallsiteRefinement extends EssaNodeRefinement {
728
773
}
729
774
730
775
CallNode getCall ( ) { this .getDefiningNode ( ) = result }
776
+
777
+ override string getAPrimaryQlClass ( ) { result = "MethodCallsiteRefinement" }
731
778
}
732
779
733
780
/** An implicit (possible) modification of `self` at a method call */
734
781
class SelfCallsiteRefinement extends MethodCallsiteRefinement {
735
782
SelfCallsiteRefinement ( ) { this .getSourceVariable ( ) .( Variable ) .isSelf ( ) }
783
+
784
+ override string getAPrimaryQlClass ( ) { result = "SelfCallsiteRefinement" }
736
785
}
737
786
738
787
/** Python specific sub-class of generic EssaEdgeRefinement */
@@ -750,4 +799,6 @@ class PyEdgeRefinement extends EssaEdgeRefinement {
750
799
}
751
800
752
801
ControlFlowNode getTest ( ) { result = this .getPredecessor ( ) .getLastNode ( ) }
802
+
803
+ override string getAPrimaryQlClass ( ) { result = "PyEdgeRefinement" }
753
804
}
0 commit comments