@@ -544,7 +544,7 @@ private API::Node getNodeFromSubPath(API::Node base, AccessPath subPath) {
544
544
}
545
545
546
546
/** Gets the node identified by the given `(package, type, path)` tuple. */
547
- API:: Node getNodeFromPath ( string package , string type , AccessPath path ) {
547
+ private API:: Node getNodeFromPath ( string package , string type , AccessPath path ) {
548
548
result = getNodeFromPath ( package , type , path , path .getNumToken ( ) )
549
549
}
550
550
@@ -567,23 +567,25 @@ private predicate typeStep(API::Node pred, API::Node succ) {
567
567
*
568
568
* Unlike `getNodeFromPath`, the `path` may end with one or more call-site filters.
569
569
*/
570
- Specific:: InvokeNode getInvocationFromPath ( string package , string type , AccessPath path , int n ) {
570
+ private Specific:: InvokeNode getInvocationFromPath (
571
+ string package , string type , AccessPath path , int n
572
+ ) {
571
573
result = Specific:: getAnInvocationOf ( getNodeFromPath ( package , type , path , n ) )
572
574
or
573
575
result = getInvocationFromPath ( package , type , path , n - 1 ) and
574
576
invocationMatchesCallSiteFilter ( result , path .getToken ( n - 1 ) )
575
577
}
576
578
577
579
/** Gets an invocation identified by the given `(package, type, path)` tuple. */
578
- Specific:: InvokeNode getInvocationFromPath ( string package , string type , AccessPath path ) {
580
+ private Specific:: InvokeNode getInvocationFromPath ( string package , string type , AccessPath path ) {
579
581
result = getInvocationFromPath ( package , type , path , path .getNumToken ( ) )
580
582
}
581
583
582
584
/**
583
585
* Holds if `name` is a valid name for an access path token in the identifying access path.
584
586
*/
585
587
bindingset [ name]
586
- predicate isValidTokenNameInIdentifyingAccessPath ( string name ) {
588
+ private predicate isValidTokenNameInIdentifyingAccessPath ( string name ) {
587
589
name = [ "Argument" , "Parameter" , "ReturnValue" , "WithArity" , "TypeVar" ]
588
590
or
589
591
Specific:: isExtraValidTokenNameInIdentifyingAccessPath ( name )
@@ -594,7 +596,7 @@ predicate isValidTokenNameInIdentifyingAccessPath(string name) {
594
596
* in an identifying access path.
595
597
*/
596
598
bindingset [ name]
597
- predicate isValidNoArgumentTokenInIdentifyingAccessPath ( string name ) {
599
+ private predicate isValidNoArgumentTokenInIdentifyingAccessPath ( string name ) {
598
600
name = "ReturnValue"
599
601
or
600
602
Specific:: isExtraValidNoArgumentTokenInIdentifyingAccessPath ( name )
@@ -605,7 +607,7 @@ predicate isValidNoArgumentTokenInIdentifyingAccessPath(string name) {
605
607
* in an identifying access path.
606
608
*/
607
609
bindingset [ name, argument]
608
- predicate isValidTokenArgumentInIdentifyingAccessPath ( string name , string argument ) {
610
+ private predicate isValidTokenArgumentInIdentifyingAccessPath ( string name , string argument ) {
609
611
name = [ "Argument" , "Parameter" ] and
610
612
argument .regexpMatch ( "(N-|-)?\\d+(\\.\\.((N-|-)?\\d+)?)?" )
611
613
or
@@ -622,51 +624,61 @@ predicate isValidTokenArgumentInIdentifyingAccessPath(string name, string argume
622
624
* Module providing access to the imported models in terms of API graph nodes.
623
625
*/
624
626
module ModelOutput {
625
- /**
626
- * Holds if a CSV source model contributed `source` with the given `kind`.
627
- */
628
- API:: Node getASourceNode ( string kind ) {
629
- exists ( string package , string type , string path |
630
- sourceModel ( package , type , path , kind ) and
631
- result = getNodeFromPath ( package , type , path )
632
- )
633
- }
627
+ cached
628
+ private module Cached {
629
+ /**
630
+ * Holds if a CSV source model contributed `source` with the given `kind`.
631
+ */
632
+ cached
633
+ API:: Node getASourceNode ( string kind ) {
634
+ exists ( string package , string type , string path |
635
+ sourceModel ( package , type , path , kind ) and
636
+ result = getNodeFromPath ( package , type , path )
637
+ )
638
+ }
634
639
635
- /**
636
- * Holds if a CSV sink model contributed `sink` with the given `kind`.
637
- */
638
- API:: Node getASinkNode ( string kind ) {
639
- exists ( string package , string type , string path |
640
- sinkModel ( package , type , path , kind ) and
641
- result = getNodeFromPath ( package , type , path )
642
- )
643
- }
640
+ /**
641
+ * Holds if a CSV sink model contributed `sink` with the given `kind`.
642
+ */
643
+ cached
644
+ API:: Node getASinkNode ( string kind ) {
645
+ exists ( string package , string type , string path |
646
+ sinkModel ( package , type , path , kind ) and
647
+ result = getNodeFromPath ( package , type , path )
648
+ )
649
+ }
644
650
645
- /**
646
- * Holds if a relevant CSV summary exists for these parameters.
647
- */
648
- predicate relevantSummaryModel (
649
- string package , string type , string path , string input , string output , string kind
650
- ) {
651
- isRelevantPackage ( package ) and
652
- summaryModel ( package , type , path , input , output , kind )
653
- }
651
+ /**
652
+ * Holds if a relevant CSV summary exists for these parameters.
653
+ */
654
+ cached
655
+ predicate relevantSummaryModel (
656
+ string package , string type , string path , string input , string output , string kind
657
+ ) {
658
+ isRelevantPackage ( package ) and
659
+ summaryModel ( package , type , path , input , output , kind )
660
+ }
654
661
655
- /**
656
- * Holds if a `baseNode` is an invocation identified by the `package,type,path` part of a summary row.
657
- */
658
- predicate resolvedSummaryBase (
659
- string package , string type , string path , Specific:: InvokeNode baseNode
660
- ) {
661
- summaryModel ( package , type , path , _, _, _) and
662
- baseNode = getInvocationFromPath ( package , type , path )
662
+ /**
663
+ * Holds if a `baseNode` is an invocation identified by the `package,type,path` part of a summary row.
664
+ */
665
+ cached
666
+ predicate resolvedSummaryBase (
667
+ string package , string type , string path , Specific:: InvokeNode baseNode
668
+ ) {
669
+ summaryModel ( package , type , path , _, _, _) and
670
+ baseNode = getInvocationFromPath ( package , type , path )
671
+ }
672
+
673
+ /**
674
+ * Holds if `node` is seen as an instance of `(package,type)` due to a type definition
675
+ * contributed by a CSV model.
676
+ */
677
+ cached
678
+ API:: Node getATypeNode ( string package , string type ) { result = getNodeFromType ( package , type ) }
663
679
}
664
680
665
- /**
666
- * Holds if `node` is seen as an instance of `(package,type)` due to a type definition
667
- * contributed by a CSV model.
668
- */
669
- API:: Node getATypeNode ( string package , string type ) { result = getNodeFromType ( package , type ) }
681
+ import Cached
670
682
671
683
/**
672
684
* Gets an error message relating to an invalid CSV row in a model.
0 commit comments