@@ -340,20 +340,20 @@ module Routing {
340
340
*/
341
341
string getAPrimaryQlClass ( ) { result = "RouteImpl" }
342
342
343
- MethodCall method ;
343
+ MethodCall methodCall ;
344
344
345
345
/** Gets a string representation of this route. */
346
- string toString ( ) { result = method .toString ( ) }
346
+ string toString ( ) { result = methodCall .toString ( ) }
347
347
348
348
/**
349
349
* Gets the location of the method call that defines this route.
350
350
*/
351
- Location getLocation ( ) { result = method .getLocation ( ) }
351
+ Location getLocation ( ) { result = methodCall .getLocation ( ) }
352
352
353
353
/**
354
354
* Gets the method call that defines this route.
355
355
*/
356
- MethodCall getDefiningMethodCall ( ) { result = method }
356
+ MethodCall getDefiningMethodCall ( ) { result = methodCall }
357
357
358
358
/**
359
359
* Get the last component of the path. For example, in
@@ -473,20 +473,20 @@ module Routing {
473
473
private class ExplicitRoute extends RouteImpl , TExplicitRoute {
474
474
RouteBlock parentBlock ;
475
475
476
- ExplicitRoute ( ) { this = TExplicitRoute ( parentBlock , method ) }
476
+ ExplicitRoute ( ) { this = TExplicitRoute ( parentBlock , methodCall ) }
477
477
478
478
override string getAPrimaryQlClass ( ) { result = "ExplicitRoute" }
479
479
480
480
override RouteBlock getParentBlock ( ) { result = parentBlock }
481
481
482
482
override string getLastPathComponent ( ) {
483
- method .getArgument ( 0 ) .getConstantValue ( ) .isStringlikeValue ( result )
483
+ methodCall .getArgument ( 0 ) .getConstantValue ( ) .isStringlikeValue ( result )
484
484
}
485
485
486
486
override string getLastControllerComponent ( ) {
487
- method .getKeywordArgument ( "controller" ) .getConstantValue ( ) .isStringlikeValue ( result )
487
+ methodCall .getKeywordArgument ( "controller" ) .getConstantValue ( ) .isStringlikeValue ( result )
488
488
or
489
- not exists ( method .getKeywordArgument ( "controller" ) ) and
489
+ not exists ( methodCall .getKeywordArgument ( "controller" ) ) and
490
490
(
491
491
result = extractController ( this .getActionString ( ) )
492
492
or
@@ -508,17 +508,17 @@ module Routing {
508
508
}
509
509
510
510
private string getActionString ( ) {
511
- method .getKeywordArgument ( "to" ) .getConstantValue ( ) .isStringlikeValue ( result )
511
+ methodCall .getKeywordArgument ( "to" ) .getConstantValue ( ) .isStringlikeValue ( result )
512
512
or
513
- method .getKeywordArgument ( "to" ) .( MethodCall ) .getMethodName ( ) = "redirect" and
513
+ methodCall .getKeywordArgument ( "to" ) .( MethodCall ) .getMethodName ( ) = "redirect" and
514
514
result = "<redirect>#<redirect>"
515
515
}
516
516
517
517
override string getAction ( ) {
518
518
// get "/photos", action: "index"
519
- method .getKeywordArgument ( "action" ) .getConstantValue ( ) .isStringlikeValue ( result )
519
+ methodCall .getKeywordArgument ( "action" ) .getConstantValue ( ) .isStringlikeValue ( result )
520
520
or
521
- not exists ( method .getKeywordArgument ( "action" ) ) and
521
+ not exists ( methodCall .getKeywordArgument ( "action" ) ) and
522
522
(
523
523
// get "/photos", to: "photos#index"
524
524
// get "/photos", to: redirect("some_url")
@@ -531,11 +531,11 @@ module Routing {
531
531
or
532
532
// get :some_action
533
533
not exists ( this .getActionString ( ) ) and
534
- method .getArgument ( 0 ) .getConstantValue ( ) .isStringlikeValue ( result )
534
+ methodCall .getArgument ( 0 ) .getConstantValue ( ) .isStringlikeValue ( result )
535
535
)
536
536
}
537
537
538
- override string getHttpMethod ( ) { result = method .getMethodName ( ) .toString ( ) }
538
+ override string getHttpMethod ( ) { result = methodCall .getMethodName ( ) .toString ( ) }
539
539
}
540
540
541
541
/**
@@ -577,8 +577,8 @@ module Routing {
577
577
578
578
ResourcesRoute ( ) {
579
579
exists ( string resource |
580
- this = TResourcesRoute ( parent , method , action ) and
581
- method .getArgument ( 0 ) .getConstantValue ( ) .isStringlikeValue ( resource ) and
580
+ this = TResourcesRoute ( parent , methodCall , action ) and
581
+ methodCall .getArgument ( 0 ) .getConstantValue ( ) .isStringlikeValue ( resource ) and
582
582
isDefaultResourceRoute ( resource , httpMethod , pathComponent , action )
583
583
)
584
584
}
@@ -590,7 +590,7 @@ module Routing {
590
590
override string getLastPathComponent ( ) { result = pathComponent }
591
591
592
592
override string getLastControllerComponent ( ) {
593
- method .getArgument ( 0 ) .getConstantValue ( ) .isStringlikeValue ( result )
593
+ methodCall .getArgument ( 0 ) .getConstantValue ( ) .isStringlikeValue ( result )
594
594
}
595
595
596
596
override string getAction ( ) { result = action }
@@ -615,8 +615,8 @@ module Routing {
615
615
616
616
SingularResourceRoute ( ) {
617
617
exists ( string resource |
618
- this = TResourceRoute ( parent , method , action ) and
619
- method .getArgument ( 0 ) .getConstantValue ( ) .isStringlikeValue ( resource ) and
618
+ this = TResourceRoute ( parent , methodCall , action ) and
619
+ methodCall .getArgument ( 0 ) .getConstantValue ( ) .isStringlikeValue ( resource ) and
620
620
isDefaultSingularResourceRoute ( resource , httpMethod , pathComponent , action )
621
621
)
622
622
}
@@ -628,7 +628,7 @@ module Routing {
628
628
override string getLastPathComponent ( ) { result = pathComponent }
629
629
630
630
override string getLastControllerComponent ( ) {
631
- method .getArgument ( 0 ) .getConstantValue ( ) .isStringlikeValue ( result )
631
+ methodCall .getArgument ( 0 ) .getConstantValue ( ) .isStringlikeValue ( result )
632
632
}
633
633
634
634
override string getAction ( ) { result = action }
@@ -652,24 +652,27 @@ module Routing {
652
652
private class MatchRoute extends RouteImpl , TMatchRoute {
653
653
private RouteBlock parent ;
654
654
655
- MatchRoute ( ) { this = TMatchRoute ( parent , method ) }
655
+ MatchRoute ( ) { this = TMatchRoute ( parent , methodCall ) }
656
656
657
657
override string getAPrimaryQlClass ( ) { result = "MatchRoute" }
658
658
659
659
override RouteBlock getParentBlock ( ) { result = parent }
660
660
661
661
override string getLastPathComponent ( ) {
662
- [ method .getArgument ( 0 ) , method .getArgument ( 0 ) .( Pair ) .getKey ( ) ]
662
+ [ methodCall .getArgument ( 0 ) , methodCall .getArgument ( 0 ) .( Pair ) .getKey ( ) ]
663
663
.getConstantValue ( )
664
664
.isStringlikeValue ( result )
665
665
}
666
666
667
667
override string getLastControllerComponent ( ) {
668
668
result =
669
- extractController ( method .getKeywordArgument ( "to" ) .getConstantValue ( ) .getStringlikeValue ( ) ) or
670
- method .getKeywordArgument ( "controller" ) .getConstantValue ( ) .isStringlikeValue ( result ) or
669
+ extractController ( methodCall
670
+ .getKeywordArgument ( "to" )
671
+ .getConstantValue ( )
672
+ .getStringlikeValue ( ) ) or
673
+ methodCall .getKeywordArgument ( "controller" ) .getConstantValue ( ) .isStringlikeValue ( result ) or
671
674
result =
672
- extractController ( method
675
+ extractController ( methodCall
673
676
.getArgument ( 0 )
674
677
.( Pair )
675
678
.getValue ( )
@@ -679,15 +682,15 @@ module Routing {
679
682
680
683
override string getHttpMethod ( ) {
681
684
exists ( string via |
682
- method .getKeywordArgument ( "via" ) .getConstantValue ( ) .isStringlikeValue ( via )
685
+ methodCall .getKeywordArgument ( "via" ) .getConstantValue ( ) .isStringlikeValue ( via )
683
686
|
684
687
via = "all" and result = anyHttpMethod ( )
685
688
or
686
689
via != "all" and result = via
687
690
)
688
691
or
689
692
result =
690
- method
693
+ methodCall
691
694
.getKeywordArgument ( "via" )
692
695
.( ArrayLiteral )
693
696
.getElement ( _)
@@ -697,10 +700,10 @@ module Routing {
697
700
698
701
override string getAction ( ) {
699
702
result =
700
- extractAction ( method .getKeywordArgument ( "to" ) .getConstantValue ( ) .getStringlikeValue ( ) ) or
701
- method .getKeywordArgument ( "action" ) .getConstantValue ( ) .isStringlikeValue ( result ) or
703
+ extractAction ( methodCall .getKeywordArgument ( "to" ) .getConstantValue ( ) .getStringlikeValue ( ) ) or
704
+ methodCall .getKeywordArgument ( "action" ) .getConstantValue ( ) .isStringlikeValue ( result ) or
702
705
result =
703
- extractAction ( method
706
+ extractAction ( methodCall
704
707
.getArgument ( 0 )
705
708
.( Pair )
706
709
.getValue ( )
0 commit comments