@@ -120,17 +120,8 @@ module API {
120120 * ```
121121 */
122122 pragma [ inline]
123- DataFlow:: LocalSourceNode asSource ( ) { result = pragma [ only_bind_out ] ( this ) .asSourceInternal ( ) }
124-
125- /**
126- * INTERNAL USE ONLY.
127- *
128- * Same as `asSource()` but without join-order hints.
129- */
130- cached
131- DataFlow:: LocalSourceNode asSourceInternal ( ) {
132- Impl:: forceCachingInSameStage ( ) and
133- Impl:: use ( this , result )
123+ DataFlow:: LocalSourceNode asSource ( ) {
124+ result = pragma [ only_bind_out ] ( this ) .( Node:: Internal ) .asSourceInternal ( )
134125 }
135126
136127 /**
@@ -189,17 +180,8 @@ module API {
189180 * - An attribute of an object
190181 */
191182 pragma [ inline]
192- Node getMember ( string m ) { result = pragma [ only_bind_out ] ( this ) .getMemberInternal ( m ) }
193-
194- /**
195- * INTERNAL USE ONLY.
196- *
197- * Same as `getMember` but without join-order hints.
198- */
199- cached
200- Node getMemberInternal ( string m ) {
201- Impl:: forceCachingInSameStage ( ) and
202- result = this .getASuccessor ( Label:: member ( m ) )
183+ Node getMember ( string m ) {
184+ result = pragma [ only_bind_out ] ( this ) .( Node:: Internal ) .getMemberInternal ( m )
203185 }
204186
205187 /**
@@ -231,35 +213,14 @@ module API {
231213 */
232214 pragma [ inline]
233215 MethodAccessNode getMethod ( string method ) {
234- result = pragma [ only_bind_out ] ( this ) .getMethodInternal ( method )
235- }
236-
237- /**
238- * INTERNAL USE ONLY.
239- *
240- * Same as `getMethod` but without join-order hints.
241- */
242- cached
243- MethodAccessNode getMethodInternal ( string method ) {
244- Impl:: forceCachingInSameStage ( ) and
245- result = this .getASubclass ( ) .getASuccessor ( Label:: method ( method ) )
216+ result = pragma [ only_bind_out ] ( this ) .( Node:: Internal ) .getMethodInternal ( method )
246217 }
247218
248219 /**
249220 * Gets a node representing the result of this call.
250221 */
251222 pragma [ inline]
252- Node getReturn ( ) { result = pragma [ only_bind_out ] ( this ) .getReturnInternal ( ) }
253-
254- /**
255- * INTERNAL USE ONLY.
256- *
257- * Same as `getReturn()` but without join-order hints.
258- */
259- cached
260- Node getReturnInternal ( ) {
261- Impl:: forceCachingInSameStage ( ) and result = this .getASuccessor ( Label:: return ( ) )
262- }
223+ Node getReturn ( ) { result = pragma [ only_bind_out ] ( this ) .( Node:: Internal ) .getReturnInternal ( ) }
263224
264225 /**
265226 * Gets a node representing the result of calling a method on the receiver represented by this node.
@@ -407,7 +368,7 @@ module API {
407368 /**
408369 * Gets a textual representation of this element.
409370 */
410- abstract string toString ( ) ;
371+ string toString ( ) { none ( ) }
411372
412373 /**
413374 * Gets a path of the given `length` from the root to this node.
@@ -433,6 +394,55 @@ module API {
433394 int getDepth ( ) { result = Impl:: distanceFromRoot ( this ) }
434395 }
435396
397+ /** Companion module to the `Node` class. */
398+ module Node {
399+ /**
400+ * INTERNAL USE ONLY.
401+ *
402+ * An API node, with some internal predicates exposed.
403+ */
404+ class Internal extends Node {
405+ /**
406+ * INTERNAL USE ONLY.
407+ *
408+ * Same as `asSource()` but without join-order hints.
409+ */
410+ cached
411+ DataFlow:: LocalSourceNode asSourceInternal ( ) {
412+ Impl:: forceCachingInSameStage ( ) and
413+ Impl:: use ( this , result )
414+ }
415+
416+ /**
417+ * Same as `getMember` but without join-order hints.
418+ */
419+ cached
420+ Node getMemberInternal ( string m ) {
421+ Impl:: forceCachingInSameStage ( ) and
422+ result = this .getASuccessor ( Label:: member ( m ) )
423+ }
424+
425+ /**
426+ * Same as `getMethod` but without join-order hints.
427+ */
428+ cached
429+ MethodAccessNode getMethodInternal ( string method ) {
430+ Impl:: forceCachingInSameStage ( ) and
431+ result = this .getASubclass ( ) .getASuccessor ( Label:: method ( method ) )
432+ }
433+
434+ /**
435+ * INTERNAL USE ONLY.
436+ *
437+ * Same as `getReturn()` but without join-order hints.
438+ */
439+ cached
440+ Node getReturnInternal ( ) {
441+ Impl:: forceCachingInSameStage ( ) and result = this .getASuccessor ( Label:: return ( ) )
442+ }
443+ }
444+ }
445+
436446 bindingset [ node]
437447 pragma [ inline_late]
438448 private DataFlow:: Node getAValueReachableFromSourceInline ( Node node ) {
@@ -525,7 +535,7 @@ module API {
525535 */
526536 cached
527537 Node getTopLevelMember ( string m ) {
528- Impl:: forceCachingInSameStage ( ) and result = root ( ) .getMemberInternal ( m )
538+ Impl:: forceCachingInSameStage ( ) and result = root ( ) .( Node :: Internal ) . getMemberInternal ( m )
529539 }
530540
531541 /**
@@ -563,9 +573,12 @@ module API {
563573 or
564574 exists (
565575 any ( Node n )
576+ .( Node:: Internal )
566577 .getMemberInternal ( "foo" )
567578 .getAMember ( )
579+ .( Node:: Internal )
568580 .getMethodInternal ( "foo" )
581+ .( Node:: Internal )
569582 .getReturnInternal ( )
570583 .getParameter ( 0 )
571584 .getKeywordParameter ( "foo" )
@@ -574,6 +587,7 @@ module API {
574587 .getContent ( _)
575588 .getField ( _)
576589 .getAnElement ( )
590+ .( Node:: Internal )
577591 .asSourceInternal ( )
578592 )
579593 }
0 commit comments