@@ -86,13 +86,13 @@ module Routing {
86
86
* ```
87
87
*/
88
88
private class TopLevelRouteBlock extends RouteBlock , TTopLevelRouteBlock {
89
- MethodCall call ;
89
+ MethodCall methodCall ;
90
90
// Routing blocks create scopes which define the namespace for controllers and paths,
91
91
// though they can be overridden in various ways.
92
92
// The namespaces can differ, so we track them separately.
93
93
Block block ;
94
94
95
- TopLevelRouteBlock ( ) { this = TTopLevelRouteBlock ( _, call , block ) }
95
+ TopLevelRouteBlock ( ) { this = TTopLevelRouteBlock ( _, methodCall , block ) }
96
96
97
97
override string getAPrimaryQlClass ( ) { result = "TopLevelRouteBlock" }
98
98
@@ -102,9 +102,9 @@ module Routing {
102
102
103
103
override RouteBlock getParent ( ) { none ( ) }
104
104
105
- override string toString ( ) { result = call .toString ( ) }
105
+ override string toString ( ) { result = methodCall .toString ( ) }
106
106
107
- override Location getLocation ( ) { result = call .getLocation ( ) }
107
+ override Location getLocation ( ) { result = methodCall .getLocation ( ) }
108
108
109
109
override string getPathComponent ( ) { none ( ) }
110
110
@@ -122,9 +122,9 @@ module Routing {
122
122
*/
123
123
private class ConstraintsRouteBlock extends NestedRouteBlock , TConstraintsRouteBlock {
124
124
private Block block ;
125
- private MethodCall call ;
125
+ private MethodCall methodCall ;
126
126
127
- ConstraintsRouteBlock ( ) { this = TConstraintsRouteBlock ( parent , call , block ) }
127
+ ConstraintsRouteBlock ( ) { this = TConstraintsRouteBlock ( parent , methodCall , block ) }
128
128
129
129
override string getAPrimaryQlClass ( ) { result = "ConstraintsRouteBlock" }
130
130
@@ -134,9 +134,9 @@ module Routing {
134
134
135
135
override string getControllerComponent ( ) { result = "" }
136
136
137
- override string toString ( ) { result = call .toString ( ) }
137
+ override string toString ( ) { result = methodCall .toString ( ) }
138
138
139
- override Location getLocation ( ) { result = call .getLocation ( ) }
139
+ override Location getLocation ( ) { result = methodCall .getLocation ( ) }
140
140
}
141
141
142
142
/**
@@ -149,28 +149,31 @@ module Routing {
149
149
* https://api.rubyonrails.org/classes/ActionDispatch/Routing/Mapper/Scoping.html#method-i-scope
150
150
*/
151
151
private class ScopeRouteBlock extends NestedRouteBlock , TScopeRouteBlock {
152
- private MethodCall call ;
152
+ private MethodCall methodCall ;
153
153
private Block block ;
154
154
155
- ScopeRouteBlock ( ) { this = TScopeRouteBlock ( parent , call , block ) }
155
+ ScopeRouteBlock ( ) { this = TScopeRouteBlock ( parent , methodCall , block ) }
156
156
157
157
override string getAPrimaryQlClass ( ) { result = "ScopeRouteBlock" }
158
158
159
159
override Stmt getAStmt ( ) { result = block .getAStmt ( ) }
160
160
161
- override string toString ( ) { result = call .toString ( ) }
161
+ override string toString ( ) { result = methodCall .toString ( ) }
162
162
163
- override Location getLocation ( ) { result = call .getLocation ( ) }
163
+ override Location getLocation ( ) { result = methodCall .getLocation ( ) }
164
164
165
165
override string getPathComponent ( ) {
166
- call .getKeywordArgument ( "path" ) .getConstantValue ( ) .isStringlikeValue ( result )
166
+ methodCall .getKeywordArgument ( "path" ) .getConstantValue ( ) .isStringlikeValue ( result )
167
167
or
168
- not exists ( call .getKeywordArgument ( "path" ) ) and
169
- call .getArgument ( 0 ) .getConstantValue ( ) .isStringlikeValue ( result )
168
+ not exists ( methodCall .getKeywordArgument ( "path" ) ) and
169
+ methodCall .getArgument ( 0 ) .getConstantValue ( ) .isStringlikeValue ( result )
170
170
}
171
171
172
172
override string getControllerComponent ( ) {
173
- call .getKeywordArgument ( [ "controller" , "module" ] ) .getConstantValue ( ) .isStringlikeValue ( result )
173
+ methodCall
174
+ .getKeywordArgument ( [ "controller" , "module" ] )
175
+ .getConstantValue ( )
176
+ .isStringlikeValue ( result )
174
177
}
175
178
}
176
179
@@ -184,10 +187,10 @@ module Routing {
184
187
* https://api.rubyonrails.org/classes/ActionDispatch/Routing/Mapper/Resources.html#method-i-resources
185
188
*/
186
189
private class ResourcesRouteBlock extends NestedRouteBlock , TResourcesRouteBlock {
187
- private MethodCall call ;
190
+ private MethodCall methodCall ;
188
191
private Block block ;
189
192
190
- ResourcesRouteBlock ( ) { this = TResourcesRouteBlock ( parent , call , block ) }
193
+ ResourcesRouteBlock ( ) { this = TResourcesRouteBlock ( parent , methodCall , block ) }
191
194
192
195
override string getAPrimaryQlClass ( ) { result = "ResourcesRouteBlock" }
193
196
@@ -196,19 +199,21 @@ module Routing {
196
199
/**
197
200
* Gets the `resources` call that gives rise to this route block.
198
201
*/
199
- MethodCall getDefiningMethodCall ( ) { result = call }
202
+ MethodCall getDefiningMethodCall ( ) { result = methodCall }
200
203
201
204
override string getPathComponent ( ) {
202
- exists ( string resource | call .getArgument ( 0 ) .getConstantValue ( ) .isStringlikeValue ( resource ) |
205
+ exists ( string resource |
206
+ methodCall .getArgument ( 0 ) .getConstantValue ( ) .isStringlikeValue ( resource )
207
+ |
203
208
result = resource + "/:" + singularize ( resource ) + "_id"
204
209
)
205
210
}
206
211
207
212
override string getControllerComponent ( ) { result = "" }
208
213
209
- override string toString ( ) { result = call .toString ( ) }
214
+ override string toString ( ) { result = methodCall .toString ( ) }
210
215
211
- override Location getLocation ( ) { result = call .getLocation ( ) }
216
+ override Location getLocation ( ) { result = methodCall .getLocation ( ) }
212
217
}
213
218
214
219
/**
@@ -250,10 +255,10 @@ module Routing {
250
255
* https://api.rubyonrails.org/classes/ActionDispatch/Routing/Mapper/Scoping.html#method-i-namespace
251
256
*/
252
257
private class NamespaceRouteBlock extends NestedRouteBlock , TNamespaceRouteBlock {
253
- private MethodCall call ;
258
+ private MethodCall methodCall ;
254
259
private Block block ;
255
260
256
- NamespaceRouteBlock ( ) { this = TNamespaceRouteBlock ( parent , call , block ) }
261
+ NamespaceRouteBlock ( ) { this = TNamespaceRouteBlock ( parent , methodCall , block ) }
257
262
258
263
override Stmt getAStmt ( ) { result = block .getAStmt ( ) }
259
264
@@ -262,12 +267,12 @@ module Routing {
262
267
override string getControllerComponent ( ) { result = this .getNamespace ( ) }
263
268
264
269
private string getNamespace ( ) {
265
- call .getArgument ( 0 ) .getConstantValue ( ) .isStringlikeValue ( result )
270
+ methodCall .getArgument ( 0 ) .getConstantValue ( ) .isStringlikeValue ( result )
266
271
}
267
272
268
- override string toString ( ) { result = call .toString ( ) }
273
+ override string toString ( ) { result = methodCall .toString ( ) }
269
274
270
- override Location getLocation ( ) { result = call .getLocation ( ) }
275
+ override Location getLocation ( ) { result = methodCall .getLocation ( ) }
271
276
}
272
277
273
278
/**
0 commit comments