File tree Expand file tree Collapse file tree 4 files changed +23
-6
lines changed Expand file tree Collapse file tree 4 files changed +23
-6
lines changed Original file line number Diff line number Diff line change @@ -101,9 +101,26 @@ module API {
101
101
DataFlow:: ExprNode getAnInstantiation ( ) { result = this .getInstance ( ) .getAnImmediateUse ( ) }
102
102
103
103
/**
104
- * Gets a node representing a subclass of the class represented by this node.
104
+ * Gets a node representing a (direct or indirect) subclass of the class represented by this node.
105
+ * ```rb
106
+ * class A; end
107
+ * class B < A; end
108
+ * class C < B; end
109
+ * ```
110
+ * In the example above, `getMember("A").getASubclass()` will return uses of `A`, `B` and `C`.
105
111
*/
106
- Node getASubclass ( ) { result = this .getASuccessor ( Label:: subclass ( ) ) }
112
+ Node getASubclass ( ) { result = this .getAnImmediateSubclass * ( ) }
113
+
114
+ /**
115
+ * Gets a node representing a direct subclass of the class represented by this node.
116
+ * ```rb
117
+ * class A; end
118
+ * class B < A; end
119
+ * class C < B; end
120
+ * ```
121
+ * In the example above, `getMember("A").getAnImmediateSubclass()` will return uses of `B` only.
122
+ */
123
+ Node getAnImmediateSubclass ( ) { result = this .getASuccessor ( Label:: subclass ( ) ) }
107
124
108
125
/**
109
126
* Gets a string representation of the lexicographically least among all shortest access paths
Original file line number Diff line number Diff line change @@ -28,7 +28,7 @@ class ActionControllerControllerClass extends ClassDeclaration {
28
28
// In Rails applications `ApplicationController` typically extends `ActionController::Base`, but we
29
29
// treat it separately in case the `ApplicationController` definition is not in the database.
30
30
API:: getTopLevelMember ( "ApplicationController" )
31
- ] .getASubclass * ( ) .getAUse ( ) .asExpr ( ) .getExpr ( )
31
+ ] .getASubclass ( ) .getAUse ( ) .asExpr ( ) .getExpr ( )
32
32
}
33
33
34
34
/**
Original file line number Diff line number Diff line change @@ -48,7 +48,7 @@ class ActiveRecordModelClass extends ClassDeclaration {
48
48
// In Rails applications `ApplicationRecord` typically extends `ActiveRecord::Base`, but we
49
49
// treat it separately in case the `ApplicationRecord` definition is not in the database.
50
50
API:: getTopLevelMember ( "ApplicationRecord" )
51
- ] .getASubclass * ( ) .getAUse ( ) .asExpr ( ) .getExpr ( )
51
+ ] .getASubclass ( ) .getAUse ( ) .asExpr ( ) .getExpr ( )
52
52
}
53
53
54
54
// Gets the class declaration for this class and all of its super classes
Original file line number Diff line number Diff line change @@ -71,7 +71,7 @@ private class GraphqlRelayClassicMutationClass extends ClassDeclaration {
71
71
private class GraphqlSchemaResolverClass extends ClassDeclaration {
72
72
GraphqlSchemaResolverClass ( ) {
73
73
this .getSuperclassExpr ( ) =
74
- graphQlSchema ( ) .getMember ( "Resolver" ) .getASubclass * ( ) .getAUse ( ) .asExpr ( ) .getExpr ( )
74
+ graphQlSchema ( ) .getMember ( "Resolver" ) .getASubclass ( ) .getAUse ( ) .asExpr ( ) .getExpr ( )
75
75
}
76
76
}
77
77
@@ -92,7 +92,7 @@ private class GraphqlSchemaResolverClass extends ClassDeclaration {
92
92
class GraphqlSchemaObjectClass extends ClassDeclaration {
93
93
GraphqlSchemaObjectClass ( ) {
94
94
this .getSuperclassExpr ( ) =
95
- graphQlSchema ( ) .getMember ( "Object" ) .getASubclass * ( ) .getAUse ( ) .asExpr ( ) .getExpr ( )
95
+ graphQlSchema ( ) .getMember ( "Object" ) .getASubclass ( ) .getAUse ( ) .asExpr ( ) .getExpr ( )
96
96
}
97
97
98
98
/** Gets a `GraphqlFieldDefinitionMethodCall` called in this class. */
You can’t perform that action at this time.
0 commit comments