mirror of
https://github.com/github/codeql.git
synced 2026-02-20 00:43:44 +01:00
Avoid recursion in IPA construction
This commit is contained in:
@@ -119,13 +119,13 @@ private module Cached {
|
||||
THashSplatArgument(Generated::HashSplatArgument g) or
|
||||
THashSplatParameter(Generated::HashSplatParameter g) or
|
||||
THereDoc(Generated::HeredocBeginning g) or
|
||||
TIdentifierMethodCall(Generated::Identifier g) { vcall(g) and not access(g, _) } or
|
||||
TIdentifierMethodCall(Generated::Identifier g) { isIdentifierMethodCall(g) } or
|
||||
TIf(Generated::If g) or
|
||||
TIfModifierExpr(Generated::IfModifier g) or
|
||||
TImplicitSelf(Generated::AstNode g) {
|
||||
exists(TIdentifierMethodCall(g))
|
||||
isIdentifierMethodCall(g)
|
||||
or
|
||||
exists(TRegularMethodCall(g)) and
|
||||
isRegularMethodCall(g) and
|
||||
not exists(g.(Generated::Call).getReceiver()) and
|
||||
not exists(g.(Generated::Call).getMethod().(Generated::ScopeResolution).getScope())
|
||||
} or
|
||||
@@ -165,7 +165,7 @@ private module Cached {
|
||||
TRegexLiteral(Generated::Regex g) or
|
||||
TRegexMatchExpr(Generated::Binary g) { g instanceof @binary_equaltilde } or
|
||||
TRegularArrayLiteral(Generated::Array g) or
|
||||
TRegularMethodCall(Generated::Call g) { not g.getMethod() instanceof Generated::Super } or
|
||||
TRegularMethodCall(Generated::Call g) { isRegularMethodCall(g) } or
|
||||
TRegularStringLiteral(Generated::String g) or
|
||||
TRegularSuperCall(Generated::Call g) { g.getMethod() instanceof Generated::Super } or
|
||||
TRescueClause(Generated::Rescue g) or
|
||||
@@ -230,6 +230,14 @@ private module Cached {
|
||||
TWhileModifierExpr(Generated::WhileModifier g) or
|
||||
TYieldCall(Generated::Yield g)
|
||||
|
||||
private predicate isIdentifierMethodCall(Generated::Identifier g) {
|
||||
vcall(g) and not access(g, _)
|
||||
}
|
||||
|
||||
private predicate isRegularMethodCall(Generated::Call g) {
|
||||
not g.getMethod() instanceof Generated::Super
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the underlying TreeSitter entity for a given AST node. This does not
|
||||
* include synthesized AST nodes, because they are not the primary AST node
|
||||
|
||||
@@ -262,18 +262,18 @@ break_ensure.rb:
|
||||
#-----| true -> [ensure: return] then ...
|
||||
#-----| false -> [ensure: return] if ...
|
||||
|
||||
# 35| call to x
|
||||
#-----| -> 0
|
||||
|
||||
# 35| [ensure: return] call to x
|
||||
#-----| -> [ensure: return] 0
|
||||
|
||||
# 35| self
|
||||
#-----| -> call to x
|
||||
|
||||
# 35| [ensure: return] self
|
||||
#-----| -> [ensure: return] call to x
|
||||
|
||||
# 35| call to x
|
||||
#-----| -> 0
|
||||
|
||||
# 35| [ensure: return] call to x
|
||||
#-----| -> [ensure: return] 0
|
||||
|
||||
# 35| 0
|
||||
#-----| -> ... > ...
|
||||
|
||||
@@ -429,12 +429,12 @@ case.rb:
|
||||
# 2| case ...
|
||||
#-----| -> self
|
||||
|
||||
# 2| call to x1
|
||||
#-----| -> when ...
|
||||
|
||||
# 2| self
|
||||
#-----| -> call to x1
|
||||
|
||||
# 2| call to x1
|
||||
#-----| -> when ...
|
||||
|
||||
# 3| when ...
|
||||
#-----| -> 1
|
||||
|
||||
@@ -451,13 +451,13 @@ case.rb:
|
||||
# 3| if ...
|
||||
#-----| -> ( ... )
|
||||
|
||||
# 3| self
|
||||
#-----| -> call to x2
|
||||
|
||||
# 3| call to x2
|
||||
#-----| true -> then ...
|
||||
#-----| false -> if ...
|
||||
|
||||
# 3| self
|
||||
#-----| -> call to x2
|
||||
|
||||
# 3| then ...
|
||||
#-----| -> self
|
||||
|
||||
@@ -881,12 +881,12 @@ cfg.rb:
|
||||
#-----| true -> "hello"
|
||||
#-----| false -> "bye"
|
||||
|
||||
# 60| call to b
|
||||
#-----| -> 10
|
||||
|
||||
# 60| self
|
||||
#-----| -> call to b
|
||||
|
||||
# 60| call to b
|
||||
#-----| -> 10
|
||||
|
||||
# 60| 10
|
||||
#-----| -> ... < ...
|
||||
|
||||
@@ -1330,21 +1330,21 @@ cfg.rb:
|
||||
# 109| #{...}
|
||||
#-----| -> self
|
||||
|
||||
# 109| call to table
|
||||
#-----| -> #{...}
|
||||
|
||||
# 109| self
|
||||
#-----| -> call to table
|
||||
|
||||
# 109| call to table
|
||||
#-----| -> #{...}
|
||||
|
||||
# 110| #{...}
|
||||
#-----| -> ( ... )
|
||||
|
||||
# 110| call to type
|
||||
#-----| -> #{...}
|
||||
|
||||
# 110| self
|
||||
#-----| -> call to type
|
||||
|
||||
# 110| call to type
|
||||
#-----| -> #{...}
|
||||
|
||||
# 113| call to puts
|
||||
#-----| -> ... if ...
|
||||
|
||||
@@ -1730,12 +1730,12 @@ cfg.rb:
|
||||
# 160| #{...}
|
||||
#-----| -> `cat "#{...}"`
|
||||
|
||||
# 160| call to __FILE__
|
||||
#-----| -> #{...}
|
||||
|
||||
# 160| self
|
||||
#-----| -> call to __FILE__
|
||||
|
||||
# 160| call to __FILE__
|
||||
#-----| -> #{...}
|
||||
|
||||
# 162| ... = ...
|
||||
#-----| -> delimited_symbol
|
||||
|
||||
|
||||
Reference in New Issue
Block a user