@@ -544,7 +544,7 @@ private API::Node getNodeFromSubPath(API::Node base, AccessPath subPath) {
544544}
545545
546546/** 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 ) {
548548 result = getNodeFromPath ( package , type , path , path .getNumToken ( ) )
549549}
550550
@@ -567,23 +567,25 @@ private predicate typeStep(API::Node pred, API::Node succ) {
567567 *
568568 * Unlike `getNodeFromPath`, the `path` may end with one or more call-site filters.
569569 */
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+ ) {
571573 result = Specific:: getAnInvocationOf ( getNodeFromPath ( package , type , path , n ) )
572574 or
573575 result = getInvocationFromPath ( package , type , path , n - 1 ) and
574576 invocationMatchesCallSiteFilter ( result , path .getToken ( n - 1 ) )
575577}
576578
577579/** 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 ) {
579581 result = getInvocationFromPath ( package , type , path , path .getNumToken ( ) )
580582}
581583
582584/**
583585 * Holds if `name` is a valid name for an access path token in the identifying access path.
584586 */
585587bindingset [ name]
586- predicate isValidTokenNameInIdentifyingAccessPath ( string name ) {
588+ private predicate isValidTokenNameInIdentifyingAccessPath ( string name ) {
587589 name = [ "Argument" , "Parameter" , "ReturnValue" , "WithArity" , "TypeVar" ]
588590 or
589591 Specific:: isExtraValidTokenNameInIdentifyingAccessPath ( name )
@@ -594,7 +596,7 @@ predicate isValidTokenNameInIdentifyingAccessPath(string name) {
594596 * in an identifying access path.
595597 */
596598bindingset [ name]
597- predicate isValidNoArgumentTokenInIdentifyingAccessPath ( string name ) {
599+ private predicate isValidNoArgumentTokenInIdentifyingAccessPath ( string name ) {
598600 name = "ReturnValue"
599601 or
600602 Specific:: isExtraValidNoArgumentTokenInIdentifyingAccessPath ( name )
@@ -605,7 +607,7 @@ predicate isValidNoArgumentTokenInIdentifyingAccessPath(string name) {
605607 * in an identifying access path.
606608 */
607609bindingset [ name, argument]
608- predicate isValidTokenArgumentInIdentifyingAccessPath ( string name , string argument ) {
610+ private predicate isValidTokenArgumentInIdentifyingAccessPath ( string name , string argument ) {
609611 name = [ "Argument" , "Parameter" ] and
610612 argument .regexpMatch ( "(N-|-)?\\d+(\\.\\.((N-|-)?\\d+)?)?" )
611613 or
@@ -622,51 +624,61 @@ predicate isValidTokenArgumentInIdentifyingAccessPath(string name, string argume
622624 * Module providing access to the imported models in terms of API graph nodes.
623625 */
624626module 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+ }
634639
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+ }
644650
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+ }
654661
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 ) }
663679 }
664680
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
670682
671683 /**
672684 * Gets an error message relating to an invalid CSV row in a model.
0 commit comments