@@ -313,6 +313,9 @@ module ActionDispatch {
313
313
override Location getLocation ( ) { result = call .getLocation ( ) }
314
314
}
315
315
316
+ /**
317
+ * A route configuration. See `Route` for more info
318
+ */
316
319
newtype TRoute =
317
320
/**
318
321
* See `ExplicitRoute`
@@ -343,31 +346,6 @@ module ActionDispatch {
343
346
*/
344
347
TMatchRoute ( RouteBlock b , MethodCall m ) { b .getAStmt ( ) = m and m .getMethodName ( ) = "match" }
345
348
346
- /**
347
- * Several routing methods support the keyword arguments `only:` and `except:`.
348
- * - `only:` restricts the set of actions to just those in the argument.
349
- * - `except:` removes the given actions from the set.
350
- */
351
- bindingset [ action]
352
- predicate applyActionFilters ( MethodCall m , string action ) {
353
- // Respect the `only` keyword argument, which restricts the set of actions.
354
- (
355
- not exists ( m .getKeywordArgument ( "only" ) )
356
- or
357
- exists ( Expr only | only = m .getKeywordArgument ( "only" ) |
358
- [ only .( ArrayLiteral ) .getElement ( _) , only .( StringlikeLiteral ) ] .getValueText ( ) = action
359
- )
360
- ) and
361
- // Respect the `except` keyword argument, which removes actions from the default set.
362
- (
363
- not exists ( m .getKeywordArgument ( "except" ) )
364
- or
365
- exists ( Expr except | except = m .getKeywordArgument ( "except" ) |
366
- [ except .( ArrayLiteral ) .getElement ( _) , except .( StringlikeLiteral ) ] .getValueText ( ) != action
367
- )
368
- )
369
- }
370
-
371
349
/**
372
350
* A route configuration. This defines a combination of HTTP method and URL
373
351
* path which should be routed to a particular controller-action pair.
@@ -381,12 +359,19 @@ module ActionDispatch {
381
359
* ```
382
360
*/
383
361
abstract class Route extends TRoute {
362
+ /**
363
+ * Gets the name of a primary CodeQL class to which this route belongs.
364
+ */
384
365
string getAPrimaryQlClass ( ) { result = "Route" }
385
366
386
367
MethodCall method ;
387
368
369
+ /** Gets a string representation of this route. */
388
370
string toString ( ) { result = method .toString ( ) }
389
371
372
+ /**
373
+ * Gets the location of the method call that defines this route.
374
+ */
390
375
Location getLocation ( ) { result = method .getLocation ( ) }
391
376
392
377
/**
@@ -713,6 +698,31 @@ module ActionDispatch {
713
698
}
714
699
}
715
700
701
+ /**
702
+ * Several routing methods support the keyword arguments `only:` and `except:`.
703
+ * - `only:` restricts the set of actions to just those in the argument.
704
+ * - `except:` removes the given actions from the set.
705
+ */
706
+ bindingset [ action]
707
+ predicate applyActionFilters ( MethodCall m , string action ) {
708
+ // Respect the `only` keyword argument, which restricts the set of actions.
709
+ (
710
+ not exists ( m .getKeywordArgument ( "only" ) )
711
+ or
712
+ exists ( Expr only | only = m .getKeywordArgument ( "only" ) |
713
+ [ only .( ArrayLiteral ) .getElement ( _) , only .( StringlikeLiteral ) ] .getValueText ( ) = action
714
+ )
715
+ ) and
716
+ // Respect the `except` keyword argument, which removes actions from the default set.
717
+ (
718
+ not exists ( m .getKeywordArgument ( "except" ) )
719
+ or
720
+ exists ( Expr except | except = m .getKeywordArgument ( "except" ) |
721
+ [ except .( ArrayLiteral ) .getElement ( _) , except .( StringlikeLiteral ) ] .getValueText ( ) != action
722
+ )
723
+ )
724
+ }
725
+
716
726
/**
717
727
* Holds if the (resource, method, path, action) combination would be generated by a call to `resources :<resource>`.
718
728
*/
0 commit comments