@@ -120,17 +120,8 @@ module API {
120
120
* ```
121
121
*/
122
122
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 ( )
134
125
}
135
126
136
127
/**
@@ -189,17 +180,8 @@ module API {
189
180
* - An attribute of an object
190
181
*/
191
182
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 )
203
185
}
204
186
205
187
/**
@@ -231,35 +213,14 @@ module API {
231
213
*/
232
214
pragma [ inline]
233
215
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 )
246
217
}
247
218
248
219
/**
249
220
* Gets a node representing the result of this call.
250
221
*/
251
222
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 ( ) }
263
224
264
225
/**
265
226
* Gets a node representing the result of calling a method on the receiver represented by this node.
@@ -407,7 +368,7 @@ module API {
407
368
/**
408
369
* Gets a textual representation of this element.
409
370
*/
410
- abstract string toString ( ) ;
371
+ string toString ( ) { none ( ) }
411
372
412
373
/**
413
374
* Gets a path of the given `length` from the root to this node.
@@ -433,6 +394,55 @@ module API {
433
394
int getDepth ( ) { result = Impl:: distanceFromRoot ( this ) }
434
395
}
435
396
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
+
436
446
bindingset [ node]
437
447
pragma [ inline_late]
438
448
private DataFlow:: Node getAValueReachableFromSourceInline ( Node node ) {
@@ -525,7 +535,7 @@ module API {
525
535
*/
526
536
cached
527
537
Node getTopLevelMember ( string m ) {
528
- Impl:: forceCachingInSameStage ( ) and result = root ( ) .getMemberInternal ( m )
538
+ Impl:: forceCachingInSameStage ( ) and result = root ( ) .( Node :: Internal ) . getMemberInternal ( m )
529
539
}
530
540
531
541
/**
@@ -563,9 +573,12 @@ module API {
563
573
or
564
574
exists (
565
575
any ( Node n )
576
+ .( Node:: Internal )
566
577
.getMemberInternal ( "foo" )
567
578
.getAMember ( )
579
+ .( Node:: Internal )
568
580
.getMethodInternal ( "foo" )
581
+ .( Node:: Internal )
569
582
.getReturnInternal ( )
570
583
.getParameter ( 0 )
571
584
.getKeywordParameter ( "foo" )
@@ -574,6 +587,7 @@ module API {
574
587
.getContent ( _)
575
588
.getField ( _)
576
589
.getAnElement ( )
590
+ .( Node:: Internal )
577
591
.asSourceInternal ( )
578
592
)
579
593
}
0 commit comments