@@ -590,14 +590,22 @@ class ReadNode extends InstructionNode {
590
590
}
591
591
}
592
592
593
+ /**
594
+ * A data-flow node that reads the value of a field from a struct, or an element from an array, slice, map or string.
595
+ */
596
+ class ReadFromAggregateNode extends ReadNode {
597
+ /** Gets the data-flow node representing the base from which the field or element is read. */
598
+ abstract Node getBase ( ) ;
599
+ }
600
+
593
601
/**
594
602
* A data-flow node that reads an element of an array, map, slice or string.
595
603
*/
596
- class ElementReadNode extends ReadNode {
604
+ class ElementReadNode extends ReadFromAggregateNode {
597
605
override IR:: ElementReadInstruction insn ;
598
606
599
607
/** Gets the data-flow node representing the base from which the element is read. */
600
- Node getBase ( ) { result = instructionNode ( insn .getBase ( ) ) }
608
+ override Node getBase ( ) { result = instructionNode ( insn .getBase ( ) ) }
601
609
602
610
/** Gets the data-flow node representing the index of the element being read. */
603
611
Node getIndex ( ) { result = instructionNode ( insn .getIndex ( ) ) }
@@ -744,11 +752,11 @@ class AddressOperationNode extends UnaryOperationNode, ExprNode {
744
752
/**
745
753
* A data-flow node that reads the value of a field.
746
754
*/
747
- class FieldReadNode extends ReadNode {
755
+ class FieldReadNode extends ReadFromAggregateNode {
748
756
override IR:: FieldReadInstruction insn ;
749
757
750
758
/** Gets the base node from which the field is read. */
751
- Node getBase ( ) { result = instructionNode ( insn .getBase ( ) ) }
759
+ override Node getBase ( ) { result = instructionNode ( insn .getBase ( ) ) }
752
760
753
761
/** Gets the field this node reads. */
754
762
Field getField ( ) { result = insn .getField ( ) }
0 commit comments