@@ -299,9 +299,12 @@ private predicate hasLocation(AstNode n, Location l) {
299299private module ImplicitSelfSynthesis {
300300 pragma [ nomagic]
301301 private predicate identifierMethodCallSelfSynthesis ( AstNode mc , int i , Child child ) {
302- child = SynthChild ( SelfKind ( TSelfVariable ( scopeOf ( toGenerated ( mc ) ) .getEnclosingSelfScope ( ) ) ) ) and
303- mc = TIdentifierMethodCall ( _) and
304- i = 0
302+ exists ( SelfVariableImpl self |
303+ self .getDeclaringScopeImpl ( ) = scopeOf ( toGenerated ( mc ) ) .getEnclosingSelfScope ( ) and
304+ child = SynthChild ( SelfKind ( self ) ) and
305+ mc = TIdentifierMethodCall ( _) and
306+ i = 0
307+ )
305308 }
306309
307310 private class IdentifierMethodCallSelfSynthesis extends Synthesis {
@@ -312,13 +315,14 @@ private module ImplicitSelfSynthesis {
312315
313316 pragma [ nomagic]
314317 private predicate regularMethodCallSelfSynthesis ( TRegularMethodCall mc , int i , Child child ) {
315- exists ( Ruby:: AstNode g |
318+ exists ( Ruby:: AstNode g , SelfVariableImpl self |
316319 mc = TRegularMethodCall ( g ) and
317320 // If there's no explicit receiver, then the receiver is implicitly `self`.
318- not exists ( g .( Ruby:: Call ) .getReceiver ( ) )
319- ) and
320- child = SynthChild ( SelfKind ( TSelfVariable ( scopeOf ( toGenerated ( mc ) ) .getEnclosingSelfScope ( ) ) ) ) and
321- i = 0
321+ not exists ( g .( Ruby:: Call ) .getReceiver ( ) ) and
322+ self .getDeclaringScopeImpl ( ) = scopeOf ( toGenerated ( mc ) ) .getEnclosingSelfScope ( ) and
323+ child = SynthChild ( SelfKind ( self ) ) and
324+ i = 0
325+ )
322326 }
323327
324328 private class RegularMethodCallSelfSynthesis extends Synthesis {
@@ -341,9 +345,10 @@ private module ImplicitSelfSynthesis {
341345 */
342346 pragma [ nomagic]
343347 private SelfKind getSelfKind ( InstanceVariableAccess var ) {
344- exists ( Ruby:: AstNode owner |
348+ exists ( Ruby:: AstNode owner , SelfVariableImpl self |
349+ self .getDeclaringScopeImpl ( ) = scopeOf ( owner ) .getEnclosingSelfScope ( ) and
345350 owner = toGenerated ( instanceVarAccessSynthParentStar ( var ) ) and
346- result = SelfKind ( TSelfVariable ( scopeOf ( owner ) . getEnclosingSelfScope ( ) ) )
351+ result = SelfKind ( self )
347352 )
348353 }
349354
@@ -1566,20 +1571,20 @@ private module ForLoopDesugar {
15661571 * { a: a }
15671572 * ```
15681573 */
1569- private module ImplicitHashValueSynthesis {
1570- private Ruby:: AstNode keyWithoutValue ( AstNode parent , int i ) {
1574+ module ImplicitHashValueSynthesis {
1575+ Ruby:: AstNode keyWithoutValue ( Ruby :: AstNode parent , int i ) {
15711576 exists ( Ruby:: KeywordPattern pair |
15721577 result = pair .getKey ( ) and
1573- result = toGenerated ( parent .( HashPattern ) .getKey ( i ) ) and
1578+ result = parent .( Ruby :: HashPattern ) .getChild ( i ) . ( Ruby :: KeywordPattern ) . getKey ( ) and
15741579 not exists ( pair .getValue ( ) )
15751580 )
15761581 or
1577- exists ( Ruby :: Pair pair |
1578- i = 0 and
1579- result = pair . getKey ( ) and
1580- pair = toGenerated ( parent ) and
1581- not exists ( pair .getValue ( ) )
1582- )
1582+ parent =
1583+ any ( Ruby :: Pair pair |
1584+ i = 0 and
1585+ result = pair . getKey ( ) and
1586+ not exists ( pair .getValue ( ) )
1587+ )
15831588 }
15841589
15851590 private string keyName ( Ruby:: AstNode key ) {
@@ -1589,7 +1594,7 @@ private module ImplicitHashValueSynthesis {
15891594
15901595 private class ImplicitHashValueSynthesis extends Synthesis {
15911596 final override predicate child ( AstNode parent , int i , Child child ) {
1592- exists ( Ruby:: AstNode key | key = keyWithoutValue ( parent , i ) |
1597+ exists ( Ruby:: AstNode key | key = keyWithoutValue ( toGenerated ( parent ) , i ) |
15931598 exists ( TVariableReal variable |
15941599 access ( key , variable ) and
15951600 child = SynthChild ( LocalVariableAccessRealKind ( variable ) )
@@ -1616,7 +1621,7 @@ private module ImplicitHashValueSynthesis {
16161621 }
16171622
16181623 final override predicate location ( AstNode n , Location l ) {
1619- exists ( AstNode p , int i | l = keyWithoutValue ( p , i ) .getLocation ( ) |
1624+ exists ( AstNode p , int i | l = keyWithoutValue ( toGenerated ( p ) , i ) .getLocation ( ) |
16201625 n = p .( HashPattern ) .getValue ( i )
16211626 or
16221627 i = 0 and n = p .( Pair ) .getValue ( )
0 commit comments