Skip to content

Commit bd6fe41

Browse files
committed
Merge IPA branches for implicit self
1 parent 59c83b7 commit bd6fe41

3 files changed

Lines changed: 386 additions & 386 deletions

File tree

ql/src/codeql_ruby/ast/Call.qll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ private class IdentifierMethodCall extends MethodCall, TIdentifierMethodCall {
137137

138138
final override string getMethodName() { result = getMethodName(this, g.getValue()) }
139139

140-
final override Self getReceiver() { result = TIdentifierMethodCallImplicitSelf(g) }
140+
final override Self getReceiver() { result = TImplicitSelf(g) }
141141
}
142142

143143
private class ScopeResolutionMethodCall extends MethodCall, TScopeResolutionMethodCall {
@@ -167,7 +167,7 @@ private class RegularMethodCall extends MethodCall, TRegularMethodCall {
167167
// not valid Ruby.
168168
not exists(g.getReceiver()) and
169169
not exists(g.getMethod().(Generated::ScopeResolution).getScope()) and
170-
result = TRegularMethodCallImplicitSelf(g)
170+
result = TImplicitSelf(g)
171171
}
172172

173173
final override string getMethodName() {

ql/src/codeql_ruby/ast/internal/AST.qll

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -120,9 +120,15 @@ private module Cached {
120120
THashSplatParameter(Generated::HashSplatParameter g) or
121121
THereDoc(Generated::HeredocBeginning g) or
122122
TIdentifierMethodCall(Generated::Identifier g) { vcall(g) and not access(g, _) } or
123-
TIdentifierMethodCallImplicitSelf(Generated::Identifier g) { vcall(g) and not access(g, _) } or
124123
TIf(Generated::If g) or
125124
TIfModifierExpr(Generated::IfModifier g) or
125+
TImplicitSelf(Generated::AstNode g) {
126+
exists(TIdentifierMethodCall(g))
127+
or
128+
exists(TRegularMethodCall(g)) and
129+
not exists(g.(Generated::Call).getReceiver()) and
130+
not exists(g.(Generated::Call).getMethod().(Generated::ScopeResolution).getScope())
131+
} or
126132
TInstanceVariableAccess(Generated::InstanceVariable g, AST::InstanceVariable v) {
127133
InstanceVariableAccess::range(g, v)
128134
} or
@@ -160,11 +166,6 @@ private module Cached {
160166
TRegexMatchExpr(Generated::Binary g) { g instanceof @binary_equaltilde } or
161167
TRegularArrayLiteral(Generated::Array g) or
162168
TRegularMethodCall(Generated::Call g) { not g.getMethod() instanceof Generated::Super } or
163-
TRegularMethodCallImplicitSelf(Generated::Call g) {
164-
not g.getMethod() instanceof Generated::Super and
165-
not exists(g.getReceiver()) and
166-
not exists(g.getMethod().(Generated::ScopeResolution).getScope())
167-
} or
168169
TRegularStringLiteral(Generated::String g) or
169170
TRegularSuperCall(Generated::Call g) { g.getMethod() instanceof Generated::Super } or
170171
TRescueClause(Generated::Rescue g) or
@@ -383,8 +384,7 @@ private module Cached {
383384
cached
384385
Generated::AstNode toGeneratedInclSynth(AST::AstNode n) {
385386
result = toGenerated(n) or
386-
n = TIdentifierMethodCallImplicitSelf(result) or
387-
n = TRegularMethodCallImplicitSelf(result)
387+
n = TImplicitSelf(result)
388388
}
389389
}
390390

@@ -413,7 +413,7 @@ class TConditionalLoop = TWhileExpr or TUntilExpr or TWhileModifierExpr or TUnti
413413

414414
class TLoop = TConditionalLoop or TForExpr;
415415

416-
class TSelf = TExplicitSelf or TIdentifierMethodCallImplicitSelf or TRegularMethodCallImplicitSelf;
416+
class TSelf = TExplicitSelf or TImplicitSelf;
417417

418418
class TExpr =
419419
TSelf or TArgumentList or TRescueClause or TRescueModifierExpr or TPair or TStringConcatenation or

0 commit comments

Comments
 (0)