Merge remote-tracking branch 'origin/main' into nickrolfe/user-controlled-bypass

This commit is contained in:
Nick Rolfe
2021-12-16 15:05:01 +00:00
259 changed files with 5522 additions and 3255 deletions

BIN
ruby/Cargo.lock generated

Binary file not shown.

View File

@@ -14,7 +14,7 @@ tree-sitter-embedded-template = "0.19"
tree-sitter-ruby = { git = "https://github.com/tree-sitter/tree-sitter-ruby.git", rev = "888e2e563ed3b43c417f17e57f7e29c39ce9aeea" }
clap = "2.33"
tracing = "0.1"
tracing-subscriber = { version = "0.2", features = ["env-filter"] }
tracing-subscriber = { version = "0.3.3", features = ["env-filter"] }
rayon = "1.5.0"
num_cpus = "1.13.0"
regex = "1.4.3"

View File

@@ -10,6 +10,6 @@ edition = "2018"
clap = "2.33"
node-types = { path = "../node-types" }
tracing = "0.1"
tracing-subscriber = { version = "0.2", features = ["env-filter"] }
tracing-subscriber = { version = "0.3.3", features = ["env-filter"] }
tree-sitter-embedded-template = "0.19"
tree-sitter-ruby = { git = "https://github.com/tree-sitter/tree-sitter-ruby.git", rev = "888e2e563ed3b43c417f17e57f7e29c39ce9aeea" }

1
ruby/ql/lib/CHANGELOG.md Normal file
View File

@@ -0,0 +1 @@
## 0.0.4

View File

@@ -0,0 +1 @@
## 0.0.4

View File

@@ -0,0 +1,2 @@
---
lastReleaseVersion: 0.0.4

View File

@@ -82,7 +82,7 @@ module API {
* constructor is the function represented by this node.
*
* For example, if this node represents a use of some class `A`, then there might be a node
* representing instances of `A`, typically corresponding to expressions `new A()` at the
* representing instances of `A`, typically corresponding to expressions `A.new` at the
* source level.
*
* This predicate may have multiple results when there are multiple constructor calls invoking this API component.
@@ -244,7 +244,7 @@ module API {
MkUse(DataFlow::Node nd) { isUse(nd) }
private string resolveTopLevel(ConstantReadAccess read) {
TResolved(result) = resolveScopeExpr(read) and
TResolved(result) = resolveConstantReadAccess(read) and
not result.matches("%::%")
}

View File

@@ -136,7 +136,7 @@ class ConstantReadAccess extends ConstantAccess {
this.hasGlobalScope() and
result = lookupConst(TResolved("Object"), this.getName())
or
result = lookupConst(resolveScopeExpr(this.getScopeExpr()), this.getName())
result = lookupConst(resolveConstantReadAccess(this.getScopeExpr()), this.getName())
}
override string getValueText() { result = this.getValue().getValueText() }

View File

@@ -102,7 +102,7 @@ class IfExpr extends ConditionalExpr, TIfExpr {
cond = false and result = this.getElse()
}
override AstNode getAChild(string pred) {
final override AstNode getAChild(string pred) {
result = super.getAChild(pred)
or
pred = "getThen" and result = this.getThen()
@@ -192,8 +192,8 @@ class UnlessExpr extends ConditionalExpr, TUnlessExpr {
final override string toString() { result = "unless ..." }
override AstNode getAChild(string pred) {
result = ConditionalExpr.super.getAChild(pred)
final override AstNode getAChild(string pred) {
result = super.getAChild(pred)
or
pred = "getThen" and result = this.getThen()
or
@@ -229,8 +229,8 @@ class IfModifierExpr extends ConditionalExpr, TIfModifierExpr {
final override string toString() { result = "... if ..." }
override AstNode getAChild(string pred) {
result = ConditionalExpr.super.getAChild(pred)
final override AstNode getAChild(string pred) {
result = super.getAChild(pred)
or
pred = "getBody" and result = this.getBody()
}
@@ -264,8 +264,8 @@ class UnlessModifierExpr extends ConditionalExpr, TUnlessModifierExpr {
final override string toString() { result = "... unless ..." }
override AstNode getAChild(string pred) {
result = ConditionalExpr.super.getAChild(pred)
final override AstNode getAChild(string pred) {
result = super.getAChild(pred)
or
pred = "getBody" and result = this.getBody()
}
@@ -300,8 +300,8 @@ class TernaryIfExpr extends ConditionalExpr, TTernaryIfExpr {
final override string toString() { result = "... ? ... : ..." }
override AstNode getAChild(string pred) {
result = ConditionalExpr.super.getAChild(pred)
final override AstNode getAChild(string pred) {
result = super.getAChild(pred)
or
pred = "getThen" and result = this.getThen()
or
@@ -390,7 +390,7 @@ class CaseExpr extends ControlExpr instanceof CaseExprImpl {
final override string toString() { result = "case ..." }
override AstNode getAChild(string pred) {
final override AstNode getAChild(string pred) {
result = ControlExpr.super.getAChild(pred)
or
pred = "getValue" and result = this.getValue()
@@ -444,7 +444,7 @@ class WhenExpr extends Expr, TWhenExpr {
final override string toString() { result = "when ..." }
override AstNode getAChild(string pred) {
final override AstNode getAChild(string pred) {
result = super.getAChild(pred)
or
pred = "getBody" and result = this.getBody()
@@ -517,7 +517,7 @@ class InClause extends Expr, TInClause {
final override string toString() { result = "in ... then ..." }
override AstNode getAChild(string pred) {
final override AstNode getAChild(string pred) {
result = super.getAChild(pred)
or
pred = "getBody" and result = this.getBody()
@@ -552,7 +552,7 @@ class ConditionalLoop extends Loop, TConditionalLoop {
Expr getCondition() { none() }
override AstNode getAChild(string pred) {
result = Loop.super.getAChild(pred)
result = super.getAChild(pred)
or
pred = "getCondition" and result = this.getCondition()
}
@@ -692,7 +692,7 @@ class ForExpr extends Loop, TForExpr {
final override StmtSequence getBody() { toGenerated(result) = g.getBody() }
/** Gets the pattern representing the iteration argument. */
final Pattern getPattern() { toGenerated(result) = g.getPattern() }
final LhsExpr getPattern() { toGenerated(result) = g.getPattern() }
/**
* Gets the value being iterated over. In the following example, the result
@@ -707,8 +707,8 @@ class ForExpr extends Loop, TForExpr {
final override string toString() { result = "for ... in ..." }
override AstNode getAChild(string pred) {
result = Loop.super.getAChild(pred)
final override AstNode getAChild(string pred) {
result = super.getAChild(pred)
or
pred = "getPattern" and result = this.getPattern()
or

View File

@@ -66,6 +66,87 @@ class ArgumentList extends Expr, TArgumentList {
}
}
private class LhsExpr_ =
TVariableAccess or TTokenConstantAccess or TScopeResolutionConstantAccess or TMethodCall or
TDestructuredLhsExpr;
/**
* A "left-hand-side" (LHS) expression. An `LhsExpr` can occur on the left-hand side of
* operator assignments (`AssignOperation`), on the left-hand side of assignments
* (`AssignExpr`), as patterns in for loops (`ForExpr`), and as exception variables
* in `rescue` clauses (`RescueClause`).
*
* An `LhsExpr` can be a simple variable, a constant, a call, or an element reference:
*
* ```rb
* var = 1
* var += 1
* E = 1
* foo.bar = 1
* foo[0] = 1
* rescue E => var
* ```
*/
class LhsExpr extends Expr, LhsExpr_ {
LhsExpr() { lhsExpr(this) }
/** Gets a variable used in (or introduced by) this LHS. */
Variable getAVariable() { result = this.(VariableAccess).getVariable() }
}
/**
* A "left-hand-side" (LHS) expression of a destructured assignment.
*
* Examples:
* ```rb
* a, self.b = value
* (a, b), c[3] = value
* a, b, *rest, c, d = value
* ```
*/
class DestructuredLhsExpr extends LhsExpr, TDestructuredLhsExpr {
override string getAPrimaryQlClass() { result = "DestructuredLhsExpr" }
private DestructuredLhsExprImpl getImpl() { result = toGenerated(this) }
private Ruby::AstNode getChild(int i) { result = this.getImpl().getChildNode(i) }
/** Gets the `i`th element in this destructured LHS. */
final Expr getElement(int i) {
exists(Ruby::AstNode c | c = this.getChild(i) |
toGenerated(result) = c.(Ruby::RestAssignment).getChild()
or
toGenerated(result) = c
)
}
/** Gets an element in this destructured LHS. */
final Expr getAnElement() { result = this.getElement(_) }
/**
* Gets the index of the element with the `*` marker on it, if it exists.
* In the example below the index is `2`.
* ```rb
* a, b, *rest, c, d = value
* ```
*/
final int getRestIndex() { result = this.getImpl().getRestIndex() }
override Variable getAVariable() {
result = this.getElement(_).(VariableWriteAccess).getVariable()
or
result = this.getElement(_).(DestructuredLhsExpr).getAVariable()
}
override string toString() { result = "(..., ...)" }
final override AstNode getAChild(string pred) {
result = super.getAChild(pred)
or
pred = "getElement" and result = this.getElement(_)
}
}
/** A sequence of expressions. */
class StmtSequence extends Expr, TStmtSequence {
override string getAPrimaryQlClass() { result = "StmtSequence" }
@@ -136,7 +217,7 @@ class BodyStmt extends StmtSequence, TBodyStmt {
final predicate hasEnsure() { exists(this.getEnsure()) }
override AstNode getAChild(string pred) {
result = StmtSequence.super.getAChild(pred)
result = super.getAChild(pred)
or
pred = "getRescue" and result = this.getRescue(_)
or
@@ -214,7 +295,7 @@ class Pair extends Expr, TPair {
final override string toString() { result = "Pair" }
override AstNode getAChild(string pred) {
final override AstNode getAChild(string pred) {
result = super.getAChild(pred)
or
pred = "getKey" and result = this.getKey()
@@ -283,7 +364,7 @@ class RescueClause extends Expr, TRescueClause {
final override string toString() { result = "rescue ..." }
override AstNode getAChild(string pred) {
final override AstNode getAChild(string pred) {
result = super.getAChild(pred)
or
pred = "getException" and result = this.getException(_)
@@ -325,7 +406,7 @@ class RescueModifierExpr extends Expr, TRescueModifierExpr {
final override string toString() { result = "... rescue ..." }
override AstNode getAChild(string pred) {
final override AstNode getAChild(string pred) {
result = super.getAChild(pred)
or
pred = "getBody" and result = this.getBody()
@@ -386,7 +467,7 @@ class StringConcatenation extends Expr, TStringConcatenation {
final override string toString() { result = "\"...\" \"...\"" }
override AstNode getAChild(string pred) {
final override AstNode getAChild(string pred) {
result = super.getAChild(pred)
or
pred = "getString" and result = this.getString(_)

View File

@@ -35,36 +35,59 @@ class MethodBase extends Callable, BodyStmt, Scope, TMethodBase {
or
result = BodyStmt.super.getAChild(pred)
}
/** Holds if this method is private. */
predicate isPrivate() { none() }
}
/** A call to `private`. */
private class Private extends MethodCall {
Private() { this.getMethodName() = "private" }
/**
* A method call which modifies another method in some way.
* For example, `private :foo` makes the method `foo` private.
*/
private class MethodModifier extends MethodCall {
/** Gets the name of the method that this call applies to. */
Expr getMethodArgument() { result = this.getArgument(0) }
/** Gets the method that this `private` call applies to, if any */
Expr getMethod() { result = this.getArgument(0) }
/**
* Holds if this `private` call happens inside `c`, and refers to a
* method named `name`.
*/
/** Holds if this call modifies a method with name `name` in namespace `n`. */
pragma[noinline]
predicate isRef(ClassDeclaration c, string name) {
this = c.getAStmt() and
name = this.getMethod().(SymbolLiteral).getValueText()
predicate modifiesMethod(Namespace n, string name) {
this = n.getAStmt() and
[
this.getMethodArgument().(StringlikeLiteral).getValueText(),
this.getMethodArgument().(MethodBase).getName()
] = name
}
}
/**
* Holds if this `private` call happens at position `i` inside `c`,
* and the call has no arguments.
*/
pragma[noinline]
predicate hasNoArg(ClassDeclaration c, int i) {
this = c.getStmt(i) and
not exists(this.getMethod())
/** A call to `private` or `private_class_method`. */
private class Private extends MethodModifier {
private Namespace namespace;
private int position;
Private() { this.getMethodName() = "private" and namespace.getStmt(position) = this }
override predicate modifiesMethod(Namespace n, string name) {
n = namespace and
(
// def foo
// ...
// private :foo
super.modifiesMethod(n, name)
or
// private
// ...
// def foo
not exists(this.getMethodArgument()) and
exists(MethodBase m, int i | n.getStmt(i) = m and m.getName() = name and i > position)
)
}
}
/** A call to `private_class_method`. */
private class PrivateClassMethod extends MethodModifier {
PrivateClassMethod() { this.getMethodName() = "private_class_method" }
}
/** A normal method. */
class Method extends MethodBase, TMethod {
private Ruby::Method g;
@@ -90,12 +113,6 @@ class Method extends MethodBase, TMethod {
*/
final predicate isSetter() { g.getName() instanceof Ruby::Setter }
pragma[noinline]
private predicate isDeclaredIn(ClassDeclaration c, string name) {
this = c.getAStmt() and
name = this.getName()
}
/**
* Holds if this method is private. All methods with the name prefix
* `private` are private below:
@@ -122,18 +139,10 @@ class Method extends MethodBase, TMethod {
* end
* ```
*/
predicate isPrivate() {
this = any(Private p).getMethod()
or
exists(ClassDeclaration c, Private p, string name |
this.isDeclaredIn(c, name) and
p.isRef(c, name)
)
or
exists(ClassDeclaration c, Private p, int i, int j |
p.hasNoArg(c, i) and
this = c.getStmt(j) and
j > i
override predicate isPrivate() {
exists(Namespace n, string name |
any(Private p).modifiesMethod(n, name) and
isDeclaredIn(this, n, name)
)
or
// Top-level methods are private members of the Object class
@@ -147,6 +156,14 @@ class Method extends MethodBase, TMethod {
final override string toString() { result = this.getName() }
}
/**
* Holds if the method `m` has name `name` and is declared in namespace `n`.
*/
pragma[noinline]
private predicate isDeclaredIn(MethodBase m, Namespace n, string name) {
n = m.getEnclosingModule() and name = m.getName()
}
/** A singleton method. */
class SingletonMethod extends MethodBase, TSingletonMethod {
private Ruby::SingletonMethod g;
@@ -175,6 +192,36 @@ class SingletonMethod extends MethodBase, TSingletonMethod {
or
pred = "getObject" and result = this.getObject()
}
/**
* Holds if this method is private. All methods with the name prefix
* `private` are private below:
*
* ```rb
* class C
* private_class_method def self.private1
* end
*
* def self.public
* end
*
* def self.private2
* end
* private_class_method :private2
*
* private # this has no effect on singleton methods
*
* def self.public2
* end
* end
* ```
*/
override predicate isPrivate() {
exists(Namespace n, string name |
any(PrivateClassMethod p).modifiesMethod(n, name) and
isDeclaredIn(this, n, name)
)
}
}
/**

View File

@@ -443,14 +443,14 @@ class NoRegExpMatchExpr extends BinaryOperation, TNoRegExpMatchExpr {
*/
class Assignment extends Operation instanceof AssignmentImpl {
/** Gets the left hand side of this assignment. */
final Pattern getLeftOperand() { result = super.getLeftOperandImpl() }
final LhsExpr getLeftOperand() { result = super.getLeftOperandImpl() }
/** Gets the right hand side of this assignment. */
final Expr getRightOperand() { result = super.getRightOperandImpl() }
final override string toString() { result = "... " + this.getOperator() + " ..." }
override AstNode getAChild(string pred) {
final override AstNode getAChild(string pred) {
result = Operation.super.getAChild(pred)
or
pred = "getLeftOperand" and result = this.getLeftOperand()

View File

@@ -7,7 +7,14 @@ private import internal.TreeSitter
/** A parameter. */
class Parameter extends AstNode, TParameter {
/** Gets the callable that this parameter belongs to. */
final Callable getCallable() { result.getAParameter() = this }
final Callable getCallable() {
result.getAParameter() = this
or
exists(DestructuredParameter parent |
this = parent.getAnElement() and
result = parent.getCallable()
)
}
/** Gets the zero-based position of this parameter. */
final int getPosition() { this = any(Callable c).getParameter(result) }
@@ -23,21 +30,63 @@ class Parameter extends AstNode, TParameter {
}
/**
* A parameter defined using destructuring. For example
*
* ```rb
* def tuples((a,b))
* puts "#{a} #{b}"
* end
* ```
*/
class DestructuredParameter extends Parameter, TDestructuredParameter {
private DestructuredParameterImpl getImpl() { result = toGenerated(this) }
private Ruby::AstNode getChild(int i) { result = this.getImpl().getChildNode(i) }
/** Gets the `i`th element in this destructured parameter. */
final AstNode getElement(int i) {
exists(Ruby::AstNode c | c = this.getChild(i) | toGenerated(result) = c)
}
/** Gets an element in this destructured parameter. */
final AstNode getAnElement() { result = this.getElement(_) }
override LocalVariable getAVariable() {
result = this.getAnElement().(LocalVariableWriteAccess).getVariable()
or
result = this.getAnElement().(DestructuredParameter).getAVariable()
}
override string toString() { result = "(..., ...)" }
final override AstNode getAChild(string pred) {
result = super.getAChild(pred)
or
pred = "getElement" and result = this.getElement(_)
}
final override string getAPrimaryQlClass() { result = "DestructuredParameter" }
}
/**
* DEPRECATED
*
* A parameter defined using a pattern.
*
* This includes both simple parameters and tuple parameters.
*/
class PatternParameter extends Parameter, Pattern, TPatternParameter {
deprecated class PatternParameter extends Parameter, Pattern, TPatternParameter {
override LocalVariable getAVariable() { result = Pattern.super.getAVariable() }
}
/** A parameter defined using a tuple pattern. */
class TuplePatternParameter extends PatternParameter, TuplePattern, TTuplePatternParameter {
/**
* DEPRECATED
*
* A parameter defined using a tuple pattern.
*/
deprecated class TuplePatternParameter extends PatternParameter, TuplePattern,
TDestructuredParameter {
final override LocalVariable getAVariable() { result = TuplePattern.super.getAVariable() }
final override string getAPrimaryQlClass() { result = "TuplePatternParameter" }
override AstNode getAChild(string pred) { result = TuplePattern.super.getAChild(pred) }
}
/** A named parameter. */
@@ -72,7 +121,7 @@ class NamedParameter extends Parameter, TNamedParameter {
}
/** A simple (normal) parameter. */
class SimpleParameter extends NamedParameter, PatternParameter, VariablePattern, TSimpleParameter instanceof SimpleParameterImpl {
class SimpleParameter extends NamedParameter, TSimpleParameter instanceof SimpleParameterImpl {
final override string getName() { result = SimpleParameterImpl.super.getNameImpl() }
final override LocalVariable getVariable() {

View File

@@ -6,8 +6,12 @@ private import internal.TreeSitter
private import internal.Variable
private import internal.Parameter
/** A pattern. */
class Pattern extends AstNode {
/**
* DEPRECATED
*
* A pattern.
*/
deprecated class Pattern extends AstNode {
Pattern() {
explicitAssignmentNode(toGenerated(this), _)
or
@@ -24,36 +28,20 @@ class Pattern extends AstNode {
Variable getAVariable() { none() }
}
private class LhsExpr_ =
TVariableAccess or TTokenConstantAccess or TScopeResolutionConstantAccess or TMethodCall or
TSimpleParameter;
deprecated private class TVariablePattern = TVariableAccess or TSimpleParameter;
/**
* A "left-hand-side" expression. An `LhsExpr` can occur on the left-hand side of
* operator assignments (`AssignOperation`), in patterns (`Pattern`) on the left-hand side of
* an assignment (`AssignExpr`) or for loop (`ForExpr`), and as the exception
* variable of a `rescue` clause (`RescueClause`).
* DEPRECATED
*
* An `LhsExpr` can be a simple variable, a constant, a call, or an element reference:
* ```rb
* var = 1
* var += 1
* E = 1
* foo.bar = 1
* foo[0] = 1
* rescue E => var
* ```
* A simple variable pattern.
*/
class LhsExpr extends Pattern, LhsExpr_, Expr {
deprecated class VariablePattern extends Pattern, LhsExpr, TVariablePattern {
override Variable getAVariable() { result = this.(VariableAccess).getVariable() }
}
private class TVariablePattern = TVariableAccess or TSimpleParameter;
/** A simple variable pattern. */
class VariablePattern extends Pattern, LhsExpr, TVariablePattern { }
/**
* DEPRECATED
*
* A tuple pattern.
*
* This includes both tuple patterns in parameters and assignments. Example patterns:
@@ -63,9 +51,7 @@ class VariablePattern extends Pattern, LhsExpr, TVariablePattern { }
* a, b, *rest, c, d = value
* ```
*/
class TuplePattern extends Pattern, TTuplePattern {
override string getAPrimaryQlClass() { result = "TuplePattern" }
deprecated class TuplePattern extends Pattern, TTuplePattern {
private TuplePatternImpl getImpl() { result = toGenerated(this) }
private Ruby::AstNode getChild(int i) { result = this.getImpl().getChildNode(i) }
@@ -92,10 +78,6 @@ class TuplePattern extends Pattern, TTuplePattern {
final int getRestIndex() { result = this.getImpl().getRestIndex() }
override Variable getAVariable() { result = this.getElement(_).getAVariable() }
override string toString() { result = "(..., ...)" }
override AstNode getAChild(string pred) { pred = "getElement" and result = this.getElement(_) }
}
private class TPatternNode =

View File

@@ -296,7 +296,7 @@ private module Cached {
TTokenSuperCall(Ruby::Super g) { vcall(g) } or
TToplevel(Ruby::Program g) or
TTrueLiteral(Ruby::True g) or
TTuplePatternParameter(Ruby::DestructuredParameter g) or
TDestructuredParameter(Ruby::DestructuredParameter g) or
TUnaryMinusExpr(Ruby::Unary g) { g instanceof @ruby_unary_minus } or
TUnaryPlusExpr(Ruby::Unary g) { g instanceof @ruby_unary_plus } or
TUndefStmt(Ruby::Undef g) or
@@ -321,9 +321,9 @@ private module Cached {
TBraceBlockReal or TBreakStmt or TCaseEqExpr or TCaseExpr or TCaseMatch or
TCharacterLiteral or TClassDeclaration or TClassVariableAccessReal or TComplementExpr or
TComplexLiteral or TDefinedExpr or TDelimitedSymbolLiteral or TDestructuredLeftAssignment or
TDivExprReal or TDo or TDoBlock or TElementReference or TElse or TElsif or TEmptyStmt or
TEncoding or TEndBlock or TEnsure or TEqExpr or TExponentExprReal or TFalseLiteral or
TFile or TFindPattern or TFloatLiteral or TForExpr or TForwardParameter or
TDestructuredParameter or TDivExprReal or TDo or TDoBlock or TElementReference or TElse or
TElsif or TEmptyStmt or TEncoding or TEndBlock or TEnsure or TEqExpr or TExponentExprReal or
TFalseLiteral or TFile or TFindPattern or TFloatLiteral or TForExpr or TForwardParameter or
TForwardArgument or TGEExpr or TGTExpr or TGlobalVariableAccessReal or
THashKeySymbolLiteral or THashLiteral or THashPattern or THashSplatExpr or
THashSplatNilParameter or THashSplatParameter or THereDoc or TIdentifierMethodCall or TIf or
@@ -342,8 +342,8 @@ private module Cached {
TStringConcatenation or TStringEscapeSequenceComponent or TStringInterpolationComponent or
TStringTextComponent or TSubExprReal or TSubshellLiteral or TSymbolArrayLiteral or
TTernaryIfExpr or TThen or TTokenConstantAccess or TTokenMethodName or TTokenSuperCall or
TToplevel or TTrueLiteral or TTuplePatternParameter or TUnaryMinusExpr or TUnaryPlusExpr or
TUndefStmt or TUnlessExpr or TUnlessModifierExpr or TUntilExpr or TUntilModifierExpr or
TToplevel or TTrueLiteral or TUnaryMinusExpr or TUnaryPlusExpr or TUndefStmt or
TUnlessExpr or TUnlessModifierExpr or TUntilExpr or TUntilModifierExpr or
TVariableReferencePattern or TWhenExpr or TWhileExpr or TWhileModifierExpr or TYieldCall;
class TAstNodeSynth =
@@ -502,7 +502,7 @@ private module Cached {
n = TTokenSuperCall(result) or
n = TToplevel(result) or
n = TTrueLiteral(result) or
n = TTuplePatternParameter(result) or
n = TDestructuredParameter(result) or
n = TUnaryMinusExpr(result) or
n = TUnaryPlusExpr(result) or
n = TUndefStmt(result) or
@@ -613,6 +613,15 @@ private module Cached {
or
result = toGenerated(n).getLocation()
}
cached
predicate lhsExpr(AST::Expr e) {
explicitAssignmentNode(toGenerated(e), _)
or
implicitAssignmentNode(toGenerated(e))
or
e = getSynthChild(any(AST::AssignExpr ae), 0)
}
}
import Cached
@@ -645,11 +654,13 @@ class TLoop = TConditionalLoop or TForExpr;
class TSelf = TSelfReal or TSelfSynth;
class TDestructuredLhsExpr = TDestructuredLeftAssignment or TLeftAssignmentList;
class TExpr =
TSelf or TArgumentList or TInClause or TRescueClause or TRescueModifierExpr or TPair or
TStringConcatenation or TCall or TBlockArgument or TConstantAccess or TControlExpr or
TWhenExpr or TLiteral or TCallable or TVariableAccess or TStmtSequence or TOperation or
TSimpleParameter or TForwardArgument;
TSimpleParameter or TForwardArgument or TDestructuredLhsExpr;
class TSplatExpr = TSplatExprReal or TSplatExprSynth;
@@ -778,18 +789,20 @@ class TStmt =
class TReturningStmt = TReturnStmt or TBreakStmt or TNextStmt;
class TParameter =
TPatternParameter or TBlockParameter or THashSplatParameter or THashSplatNilParameter or
TKeywordParameter or TOptionalParameter or TSplatParameter or TForwardParameter;
TSimpleParameter or TDestructuredParameter or TBlockParameter or THashSplatParameter or
THashSplatNilParameter or TKeywordParameter or TOptionalParameter or TSplatParameter or
TForwardParameter;
class TSimpleParameter = TSimpleParameterReal or TSimpleParameterSynth;
class TPatternParameter = TSimpleParameter or TTuplePatternParameter;
deprecated class TPatternParameter = TSimpleParameter or TDestructuredParameter;
class TNamedParameter =
TSimpleParameter or TBlockParameter or THashSplatParameter or TKeywordParameter or
TOptionalParameter or TSplatParameter;
class TTuplePattern = TTuplePatternParameter or TDestructuredLeftAssignment or TLeftAssignmentList;
deprecated class TTuplePattern =
TDestructuredParameter or TDestructuredLeftAssignment or TLeftAssignmentList;
class TVariableAccess =
TLocalVariableAccess or TGlobalVariableAccess or TInstanceVariableAccess or

View File

@@ -73,3 +73,29 @@ Ruby::AstNode getBodyStmtChild(TBodyStmt b, int i) {
or
result = any(Ruby::Begin g | b = TBeginExpr(g)).getChild(i)
}
abstract class DestructuredLhsExprImpl extends Ruby::AstNode {
abstract Ruby::AstNode getChildNode(int i);
final int getRestIndex() {
result = unique(int i | this.getChildNode(i) instanceof Ruby::RestAssignment)
}
}
class DestructuredLeftAssignmentImpl extends DestructuredLhsExprImpl,
Ruby::DestructuredLeftAssignment {
override Ruby::AstNode getChildNode(int i) { result = this.getChild(i) }
}
class LeftAssignmentListImpl extends DestructuredLhsExprImpl, Ruby::LeftAssignmentList {
override Ruby::AstNode getChildNode(int i) {
this =
any(Ruby::LeftAssignmentList lal |
if
strictcount(int j | exists(lal.getChild(j))) = 1 and
lal.getChild(0) instanceof Ruby::DestructuredLeftAssignment
then result = lal.getChild(0).(Ruby::DestructuredLeftAssignment).getChild(i)
else result = lal.getChild(i)
)
}
}

View File

@@ -36,7 +36,7 @@ private module Cached {
result = scopeAppend(namespaceDeclaration(n.getEnclosingModule()), n.getName())
or
exists(string container |
TResolved(container) = resolveScopeExpr(n.getScopeExpr()) and
TResolved(container) = resolveConstantReadAccess(n.getScopeExpr()) and
result = scopeAppend(container, n.getName())
)
}
@@ -58,29 +58,33 @@ private module Cached {
(
exists(ClassDeclaration d |
d = cls.getADeclaration() and
result = resolveScopeExpr(d.getSuperclassExpr())
result = resolveConstantReadAccess(d.getSuperclassExpr())
)
or
result = TResolved("Object") and
forex(ClassDeclaration d | d = cls.getADeclaration() |
not exists(resolveScopeExpr(d.getSuperclassExpr()))
not exists(resolveConstantReadAccess(d.getSuperclassExpr()))
)
)
}
private Module getACludedModule(IncludeOrPrependCall c, Module m) {
(
m = resolveConstantReadAccess(c.getReceiver())
or
m = enclosingModule(c).getModule() and
c.getReceiver() instanceof Self
) and
result = resolveConstantReadAccess(c.getAnArgument())
}
cached
Module getAnIncludedModule(Module m) {
m = TResolved("Object") and result = TResolved("Kernel")
or
exists(IncludeOrPrependCall c |
c.getMethodName() = "include" and
(
m = resolveScopeExpr(c.getReceiver())
or
m = enclosingModule(c).getModule() and
c.getReceiver() instanceof Self
) and
result = resolveScopeExpr(c.getAnArgument())
result = getACludedModule(c, m)
)
}
@@ -88,13 +92,7 @@ private module Cached {
Module getAPrependedModule(Module m) {
exists(IncludeOrPrependCall c |
c.getMethodName() = "prepend" and
(
m = resolveScopeExpr(c.getReceiver())
or
m = enclosingModule(c).getModule() and
c.getReceiver() instanceof Self
) and
result = resolveScopeExpr(c.getAnArgument())
result = getACludedModule(c, m)
)
}
@@ -102,13 +100,13 @@ private module Cached {
* Resolve class or module read access to a qualified module name.
*/
cached
TResolved resolveScopeExpr(ConstantReadAccess r) {
TResolved resolveConstantReadAccess(ConstantReadAccess r) {
exists(string qname | qname = resolveConstant(r) and result = TResolved(qname))
}
pragma[nomagic]
private string constantDefinition1(ConstantReadAccess r) {
exists(ConstantWriteAccess w | result = constantDefinition0(w) |
private string constantWriteAccess1(ConstantReadAccess r) {
exists(ConstantWriteAccess w | result = resolveConstantWriteAccess(w) |
r = w.getScopeExpr()
or
r = w.(ClassDeclaration).getSuperclassExpr()
@@ -117,8 +115,8 @@ private module Cached {
/**
* Resolve constant access (class, module or otherwise) to a qualified module name.
* `resolveScopeExpr/1` picks the best (lowest priority number) result of
* `resolveScopeExpr/2` that resolves to a constant definition. If the constant
* `resolveConstantReadAccess/1` picks the best (lowest priority number) result of
* `resolveConstantReadAccess/2` that resolves to a constant definition. If the constant
* definition is a Namespace then it is returned, if it's a constant assignment then
* the right-hand side of the assignment is resolved.
*/
@@ -127,10 +125,10 @@ private module Cached {
exists(string qname |
qname =
min(string qn, int p |
isDefinedConstant(qn) and
qn = resolveScopeExpr(r, p) and
qn = isDefinedConstant(_, _) and
qn = resolveConstantReadAccess(r, p) and
// prevent classes/modules that contain/extend themselves
not qn = constantDefinition1(r)
not qn = constantWriteAccess1(r)
|
qn order by p
)
@@ -138,7 +136,7 @@ private module Cached {
result = qname
or
exists(ConstantAssignment a |
qname = constantDefinition0(a) and
qname = resolveConstantWriteAccess(a) and
result = resolveConstant(a.getParent().(Assignment).getRightOperand())
)
)
@@ -154,7 +152,7 @@ private module Cached {
exists(AssignExpr ae, ConstantWriteAccess w |
w = ae.getLeftOperand() and
w.getName() = name and
m = resolveScopeExpr(w.getScopeExpr()) and
m = resolveConstantReadAccess(w.getScopeExpr()) and
result = ae.getRightOperand()
)
}
@@ -171,141 +169,313 @@ private predicate isToplevel(ConstantAccess n) {
)
}
private predicate isDefinedConstant(string qualifiedModuleName) {
qualifiedModuleName = [builtin(), constantDefinition0(_)]
}
private int maxDepth() { result = 1 + max(int level | exists(enclosing(_, level))) }
private ModuleBase enclosing(ModuleBase m, int level) {
result = m and level = 0
or
result = enclosing(m.getEnclosingModule(), level - 1)
}
pragma[noinline]
private Namespace enclosingNameSpaceConstantReadAccess(
ConstantReadAccess c, int priority, string name
) {
result = enclosing(c.getEnclosingModule(), priority) and
name = c.getName()
}
/**
* Resolve constant read access (typically a scope expression) to a qualified name. The
* `priority` value indicates the precedence of the solution with respect to the lookup order.
* A constant name without scope specifier is resolved against its enclosing modules (inner-most first);
* if the constant is not found in any of the enclosing modules, then the constant will be resolved
* with respect to the ancestors (prepends, includes, super classes, and their ancestors) of the
* directly enclosing module.
*/
private string resolveScopeExpr(ConstantReadAccess c, int priority) {
c.hasGlobalScope() and result = c.getName() and priority = 0
or
exists(string name |
result = qualifiedModuleName(resolveScopeExprConstantReadAccess(c, priority, name), name)
)
or
not exists(c.getScopeExpr()) and
not c.hasGlobalScope() and
(
exists(string name |
exists(Namespace n |
n = enclosingNameSpaceConstantReadAccess(c, priority, name) and
result = qualifiedModuleName(constantDefinition0(n), name)
)
or
result =
qualifiedModuleName(ancestors(qualifiedModuleNameConstantReadAccess(c, name),
priority - maxDepth()), name)
)
or
priority = maxDepth() + 4 and
qualifiedModuleNameConstantReadAccess(c, result) != "BasicObject"
)
}
pragma[nomagic]
private string resolveScopeExprConstantReadAccess(ConstantReadAccess c, int priority, string name) {
result = resolveScopeExpr(c.getScopeExpr(), priority) and
name = c.getName()
}
bindingset[qualifier, name]
private string scopeAppend(string qualifier, string name) {
if qualifier = "Object" then result = name else result = qualifier + "::" + name
}
private string qualifiedModuleName(ModuleBase m) {
result = "Object" and m instanceof Toplevel
or
result = constantDefinition0(m)
}
pragma[noinline]
private string qualifiedModuleNameConstantWriteAccess(ConstantWriteAccess c, string name) {
result = qualifiedModuleName(c.getEnclosingModule()) and
name = c.getName()
}
pragma[noinline]
private string qualifiedModuleNameConstantReadAccess(ConstantReadAccess c, string name) {
result = qualifiedModuleName(c.getEnclosingModule()) and
name = c.getName()
}
/**
* Get a qualified name for a constant definition. May return multiple qualified
* names because we over-approximate when resolving scope resolutions and ignore
* lookup order precedence. Taking lookup order into account here would lead to
* non-monotonic recursion.
* Provides predicates for resolving constant reads and writes to qualified names.
*
* Predicates suffixed with `NonRec` means that they do not depend recursively on
* `resolveConstantReadAccess`, while predicates suffixed with `Rec` do. This serves
* both as a performance optimization (minimize non-linear recursion), and as a way
* to prevent infinite recursion.
*/
private string constantDefinition0(ConstantWriteAccess c) {
c.hasGlobalScope() and result = c.getName()
or
result = scopeAppend(resolveScopeExpr(c.getScopeExpr(), _), c.getName())
or
not exists(c.getScopeExpr()) and
not c.hasGlobalScope() and
exists(string name | result = scopeAppend(qualifiedModuleNameConstantWriteAccess(c, name), name))
}
/**
* The qualified names of the ancestors of a class/module. The ancestors should be an ordered list
* of the ancestores of `prepend`ed modules, the module itself , the ancestors or `include`d modules
* and the ancestors of the super class. The priority value only distinguishes the kind of ancestor,
* it does not order the ancestors within a group of the same kind. This is an over-approximation, however,
* computing the precise order is tricky because it depends on the evaluation/file loading order.
*/
// TODO: the order of super classes can be determined more precisely even without knowing the evaluation
// order, so we should be able to make this more precise.
private string ancestors(string qname, int priority) {
result = ancestors(prepends(qname), _) and priority = 0
or
result = qname and priority = 1 and isDefinedConstant(qname)
or
result = ancestors(includes(qname), _) and priority = 2
or
result = ancestors(superclass(qname), _) and priority = 3
}
private class IncludeOrPrependCall extends MethodCall {
IncludeOrPrependCall() { this.getMethodName() = ["include", "prepend"] }
string getAModule() { result = resolveScopeExpr(this.getAnArgument(), _) }
string getTarget() {
result = resolveScopeExpr(this.getReceiver(), _)
private module ResolveImpl {
private ModuleBase enclosing(ModuleBase m, int level) {
result = m and level = 0
or
result = qualifiedModuleName(enclosingModule(this)) and
(
this.getReceiver() instanceof Self
result = enclosing(m.getEnclosingModule(), level - 1)
}
private int maxDepth() { result = 1 + max(int level | exists(enclosing(_, level))) }
pragma[noinline]
private Namespace constantReadAccessEnclosingNameSpace(
ConstantReadAccess c, int priority, string name
) {
not exists(c.getScopeExpr()) and
not c.hasGlobalScope() and
result = enclosing(c.getEnclosingModule(), priority) and
name = c.getName()
}
pragma[nomagic]
private string enclosingQualifiedModuleNameNonRec(ConstantReadAccess c, string name) {
result = qualifiedModuleNameNonRec(c.getEnclosingModule(), _, _) and
name = c.getName() and
not exists(c.getScopeExpr()) and
not c.hasGlobalScope()
}
pragma[nomagic]
private string enclosingQualifiedModuleNameRec(ConstantReadAccess c, string name) {
result = qualifiedModuleNameRec(c.getEnclosingModule(), _, _) and
name = c.getName() and
not exists(c.getScopeExpr()) and
not c.hasGlobalScope()
}
pragma[nomagic]
private string resolveConstantReadAccessScopeNonRec(
ConstantReadAccess c, int priority, string name
) {
result = resolveConstantReadAccessNonRec(c.getScopeExpr(), priority) and
name = c.getName()
}
pragma[nomagic]
private string resolveConstantReadAccessScopeRec(ConstantReadAccess c, int priority, string name) {
result = resolveConstantReadAccessRec(c.getScopeExpr(), priority) and
name = c.getName()
}
pragma[nomagic]
private string resolveConstantReadAccessNonRec(ConstantReadAccess c, int priority) {
c.hasGlobalScope() and result = c.getName() and priority = 0
or
exists(string name, string s | result = isDefinedConstantNonRec(s, name) |
s = resolveConstantReadAccessScopeNonRec(c, priority, name)
)
or
exists(string name |
exists(Namespace n, string qname |
n = constantReadAccessEnclosingNameSpace(c, priority, name) and
qname = resolveConstantWriteAccessNonRec(n, _, _) and
result = isDefinedConstantNonRec(qname, name)
)
)
or
priority = maxDepth() + 4 and
enclosingQualifiedModuleNameNonRec(c, result) != "BasicObject"
}
pragma[nomagic]
private string resolveConstantReadAccessRec(ConstantReadAccess c, int priority) {
exists(string name, string s |
result = isDefinedConstantRec(s, name) and
s = resolveConstantReadAccessScopeNonRec(c, priority, name)
or
not exists(this.getReceiver())
result = isDefinedConstant(s, name) and
s = resolveConstantReadAccessScopeRec(c, priority, name)
)
or
exists(string name |
exists(Namespace n, string qname |
n = constantReadAccessEnclosingNameSpace(c, priority, name)
|
qname = resolveConstantWriteAccess(n) and
result = isDefinedConstantRec(qname, name)
or
qname = resolveConstantWriteAccessRec(n, _, _) and
result = isDefinedConstantNonRec(qname, name)
)
or
exists(string encl | result = qualifiedModuleNameAncestors(encl, name, priority) |
encl = enclosingQualifiedModuleNameNonRec(c, name)
or
encl = enclosingQualifiedModuleNameRec(c, name)
)
)
or
priority = maxDepth() + 4 and
enclosingQualifiedModuleNameRec(c, result) != "BasicObject"
}
/**
* Resolve constant read access (typically a scope expression) to a qualified name. The
* `priority` value indicates the precedence of the solution with respect to the lookup order.
* A constant name without scope specifier is resolved against its enclosing modules (inner-most first);
* if the constant is not found in any of the enclosing modules, then the constant will be resolved
* with respect to the ancestors (prepends, includes, super classes, and their ancestors) of the
* directly enclosing module.
*/
string resolveConstantReadAccess(ConstantReadAccess c, int priority) {
result = resolveConstantReadAccessNonRec(c, priority)
or
result = resolveConstantReadAccessRec(c, priority)
}
pragma[nomagic]
private string qualifiedModuleNameNonRec(ModuleBase m, string container, string name) {
result = "Object" and
m instanceof Toplevel and
container = "" and
name = result
or
result = resolveConstantWriteAccessNonRec(m, container, name)
}
pragma[nomagic]
private string qualifiedModuleNameRec(ModuleBase m, string container, string name) {
result = resolveConstantWriteAccessRec(m, container, name)
}
pragma[nomagic]
private string qualifiedModuleNameResolveConstantWriteAccessNonRec(
ConstantWriteAccess c, string name
) {
result = qualifiedModuleNameNonRec(c.getEnclosingModule(), _, _) and
name = c.getName()
}
pragma[nomagic]
private string qualifiedModuleNameResolveConstantWriteAccessRec(ConstantWriteAccess c, string name) {
result = qualifiedModuleNameRec(c.getEnclosingModule(), _, _) and
name = c.getName()
}
pragma[nomagic]
private string resolveConstantWriteAccessNonRec(
ConstantWriteAccess c, string container, string name
) {
c.hasGlobalScope() and
result = c.getName() and
container = "" and
name = result
or
result = scopeAppend(container, name) and
(
container = resolveConstantReadAccessNonRec(c.getScopeExpr(), _) and name = c.getName()
or
not exists(c.getScopeExpr()) and
not c.hasGlobalScope() and
container = qualifiedModuleNameResolveConstantWriteAccessNonRec(c, name)
)
}
pragma[nomagic]
private string resolveConstantWriteAccessRec(ConstantWriteAccess c, string container, string name) {
result = scopeAppend(container, name) and
(
container = resolveConstantReadAccessRec(c.getScopeExpr(), _) and name = c.getName()
or
not exists(c.getScopeExpr()) and
not c.hasGlobalScope() and
container = qualifiedModuleNameResolveConstantWriteAccessRec(c, name)
)
}
/**
* Get a qualified name for a constant definition. May return multiple qualified
* names because we over-approximate when resolving scope resolutions and ignore
* lookup order precedence. Taking lookup order into account here would lead to
* non-monotonic recursion.
*/
pragma[inline]
string resolveConstantWriteAccess(ConstantWriteAccess c) {
result = resolveConstantWriteAccessNonRec(c, _, _)
or
result = resolveConstantWriteAccessRec(c, _, _)
}
pragma[nomagic]
private string isDefinedConstantNonRec(string container, string name) {
result = resolveConstantWriteAccessNonRec(_, container, name)
or
result = builtin() and
name = result and
container = "Object"
}
pragma[nomagic]
private string isDefinedConstantRec(string container, string name) {
result = resolveConstantWriteAccessRec(_, container, name)
}
pragma[inline]
string isDefinedConstant(string container, string name) {
result = isDefinedConstantNonRec(container, name)
or
result = isDefinedConstantRec(container, name)
}
/**
* The qualified names of the ancestors of a class/module. The ancestors should be an ordered list
* of the ancestores of `prepend`ed modules, the module itself , the ancestors or `include`d modules
* and the ancestors of the super class. The priority value only distinguishes the kind of ancestor,
* it does not order the ancestors within a group of the same kind. This is an over-approximation, however,
* computing the precise order is tricky because it depends on the evaluation/file loading order.
*/
// TODO: the order of super classes can be determined more precisely even without knowing the evaluation
// order, so we should be able to make this more precise.
private string ancestors(string qname, int priority) {
result = ancestors(prepends(qname), _) and priority = 0
or
result = qname and priority = 1 and qname = isDefinedConstant(_, _)
or
result = ancestors(includes(qname), _) and priority = 2
or
result = ancestors(superclass(qname), _) and priority = 3
}
pragma[nomagic]
private string qualifiedModuleNameAncestors(string encl, string name, int priority) {
result = isDefinedConstantNonRec(encl, name) and
priority = 1
or
// avoid infinite recursion
not exists(isDefinedConstantNonRec(encl, name)) and
result = isDefinedConstant(ancestors(encl, priority - maxDepth()), name)
}
class IncludeOrPrependCall extends MethodCall {
IncludeOrPrependCall() { this.getMethodName() = ["include", "prepend"] }
string getAModule() { result = resolveConstantReadAccess(this.getAnArgument(), _) }
string getTarget() {
result = resolveConstantReadAccess(this.getReceiver(), _)
or
exists(ModuleBase encl |
encl = enclosingModule(this) and
result = [qualifiedModuleNameNonRec(encl, _, _), qualifiedModuleNameRec(encl, _, _)]
|
this.getReceiver() instanceof Self
or
not exists(this.getReceiver())
)
}
}
pragma[nomagic]
private string prepends(string qname) {
exists(IncludeOrPrependCall m |
m.getMethodName() = "prepend" and
qname = m.getTarget() and
result = m.getAModule()
)
}
pragma[nomagic]
private string includes(string qname) {
qname = "Object" and
result = "Kernel"
or
exists(IncludeOrPrependCall m |
m.getMethodName() = "include" and
qname = m.getTarget() and
result = m.getAModule()
)
}
private Expr superexpr(string qname) {
exists(ClassDeclaration c |
qname = resolveConstantWriteAccess(c) and result = c.getSuperclassExpr()
)
}
pragma[nomagic]
private string superclass(string qname) {
qname = "Object" and result = "BasicObject"
or
result = resolveConstantReadAccess(superexpr(qname), _)
}
}
import ResolveImpl
/**
* A variant of AstNode::getEnclosingModule that excludes
* results that are enclosed in a block. This is a bit wrong because
@@ -323,45 +493,6 @@ private AstNode parent(AstNode n) {
not result instanceof Block
}
private string prepends(string qname) {
exists(IncludeOrPrependCall m |
m.getMethodName() = "prepend" and
qname = m.getTarget() and
result = m.getAModule()
)
}
private string includes(string qname) {
qname = "Object" and
result = "Kernel"
or
exists(IncludeOrPrependCall m |
m.getMethodName() = "include" and
qname = m.getTarget() and
result = m.getAModule()
)
}
private Expr superexpr(string qname) {
exists(ClassDeclaration c | qname = constantDefinition0(c) and result = c.getSuperclassExpr())
}
private string superclass(string qname) {
qname = "Object" and result = "BasicObject"
or
result = resolveScopeExpr(superexpr(qname), _)
}
private string qualifiedModuleName(string container, string name) {
isDefinedConstant(result) and
(
container = result.regexpCapture("(.+)::([^:]+)", 1) and
name = result.regexpCapture("(.+)::([^:]+)", 2)
or
container = "Object" and name = result
)
}
private Module getAncestors(Module m) {
result = m or
result = getAncestors(m.getAnIncludedModule()) or

View File

@@ -154,7 +154,7 @@ class BitwiseXorSynthExpr extends BinaryOperationSynth, TBitwiseXorExprSynth {
}
abstract class AssignmentImpl extends OperationImpl, TAssignment {
abstract Pattern getLeftOperandImpl();
abstract Expr getLeftOperandImpl();
abstract Expr getRightOperandImpl();
@@ -172,7 +172,7 @@ class AssignExprReal extends AssignmentImpl, TAssignExprReal {
final override string getOperatorImpl() { result = "=" }
final override Pattern getLeftOperandImpl() { toGenerated(result) = g.getLeft() }
final override Expr getLeftOperandImpl() { toGenerated(result) = g.getLeft() }
final override Expr getRightOperandImpl() { toGenerated(result) = g.getRight() }
}
@@ -180,7 +180,7 @@ class AssignExprReal extends AssignmentImpl, TAssignExprReal {
class AssignExprSynth extends AssignmentImpl, TAssignExprSynth {
final override string getOperatorImpl() { result = "=" }
final override Pattern getLeftOperandImpl() { synthChild(this, 0, result) }
final override Expr getLeftOperandImpl() { synthChild(this, 0, result) }
final override Expr getRightOperandImpl() { synthChild(this, 1, result) }
}
@@ -192,7 +192,7 @@ class AssignOperationImpl extends AssignmentImpl, TAssignOperation {
final override string getOperatorImpl() { result = g.getOperator() }
final override Pattern getLeftOperandImpl() { toGenerated(result) = g.getLeft() }
final override Expr getLeftOperandImpl() { toGenerated(result) = g.getLeft() }
final override Expr getRightOperandImpl() { toGenerated(result) = g.getRight() }
}

View File

@@ -44,3 +44,7 @@ class SimpleParameterSynthImpl extends SimpleParameterImpl, TSimpleParameterSynt
override string getNameImpl() { result = this.getVariableImpl().getName() }
}
class DestructuredParameterImpl extends Ruby::DestructuredParameter {
Ruby::AstNode getChildNode(int i) { result = this.getChild(i) }
}

View File

@@ -1,36 +1,28 @@
private import codeql.ruby.AST
private import codeql.ruby.ast.internal.Expr
private import codeql.ruby.ast.internal.Parameter
private import AST
private import TreeSitter
abstract class TuplePatternImpl extends Ruby::AstNode {
abstract Ruby::AstNode getChildNode(int i);
deprecated class TuplePatternImpl extends Ruby::AstNode {
TuplePatternImpl() {
this instanceof DestructuredParameterImpl or
this instanceof DestructuredLhsExprImpl
}
Ruby::AstNode getChildNode(int i) {
result =
[
this.(DestructuredParameterImpl).getChildNode(i),
this.(DestructuredLhsExprImpl).getChildNode(i)
]
}
final int getRestIndex() {
result = unique(int i | this.getChildNode(i) instanceof Ruby::RestAssignment)
}
}
class TuplePatternParameterImpl extends TuplePatternImpl, Ruby::DestructuredParameter {
override Ruby::AstNode getChildNode(int i) { result = this.getChild(i) }
}
class DestructuredLeftAssignmentImpl extends TuplePatternImpl, Ruby::DestructuredLeftAssignment {
override Ruby::AstNode getChildNode(int i) { result = this.getChild(i) }
}
class LeftAssignmentListImpl extends TuplePatternImpl, Ruby::LeftAssignmentList {
override Ruby::AstNode getChildNode(int i) {
this =
any(Ruby::LeftAssignmentList lal |
if
strictcount(int j | exists(lal.getChild(j))) = 1 and
lal.getChild(0) instanceof Ruby::DestructuredLeftAssignment
then result = lal.getChild(0).(Ruby::DestructuredLeftAssignment).getChild(i)
else result = lal.getChild(i)
)
}
}
/**
* Holds if `node` is a case pattern.
*/

View File

@@ -636,36 +636,36 @@ private module AssignOperationDesugar {
}
}
private module CompoundAssignDesugar {
/** An assignment where the left-hand side is a tuple pattern. */
private class TupleAssignExpr extends AssignExpr {
private TuplePattern tp;
private module DestructuredAssignDesugar {
/** A destructured assignment. */
private class DestructuredAssignExpr extends AssignExpr {
private DestructuredLhsExpr lhs;
pragma[nomagic]
TupleAssignExpr() { tp = this.getLeftOperand() }
DestructuredAssignExpr() { lhs = this.getLeftOperand() }
TuplePattern getTuplePattern() { result = tp }
DestructuredLhsExpr getLhs() { result = lhs }
pragma[nomagic]
Pattern getElement(int i) { result = tp.getElement(i) }
Expr getElement(int i) { result = lhs.getElement(i) }
pragma[nomagic]
int getNumberOfElements() {
toGenerated(tp) = any(TuplePatternImpl impl | result = count(impl.getChildNode(_)))
toGenerated(lhs) = any(DestructuredLhsExprImpl impl | result = count(impl.getChildNode(_)))
}
pragma[nomagic]
int getRestIndexOrNumberOfElements() {
result = tp.getRestIndex()
result = lhs.getRestIndex()
or
toGenerated(tp) = any(TuplePatternImpl impl | not exists(impl.getRestIndex())) and
toGenerated(lhs) = any(DestructuredLhsExprImpl impl | not exists(impl.getRestIndex())) and
result = this.getNumberOfElements()
}
}
pragma[nomagic]
private predicate compoundAssignSynthesis(AstNode parent, int i, Child child) {
exists(TupleAssignExpr tae |
private predicate destructuredAssignSynthesis(AstNode parent, int i, Child child) {
exists(DestructuredAssignExpr tae |
parent = tae and
i = -1 and
child = SynthChild(StmtSequenceKind())
@@ -689,8 +689,8 @@ private module CompoundAssignDesugar {
child = childRef(tae.getRightOperand())
)
or
exists(Pattern p, int j, int restIndex |
p = tae.getElement(j) and
exists(AstNode elem, int j, int restIndex |
elem = tae.getElement(j) and
restIndex = tae.getRestIndexOrNumberOfElements()
|
parent = seq and
@@ -700,7 +700,7 @@ private module CompoundAssignDesugar {
exists(AstNode assign | assign = TAssignExprSynth(seq, j + 1) |
parent = assign and
i = 0 and
child = childRef(p)
child = childRef(elem)
or
parent = assign and
i = 1 and
@@ -756,26 +756,26 @@ private module CompoundAssignDesugar {
* z = __synth__0[-1];
* ```
*/
private class CompoundAssignSynthesis extends Synthesis {
private class DestructuredAssignSynthesis extends Synthesis {
final override predicate child(AstNode parent, int i, Child child) {
compoundAssignSynthesis(parent, i, child)
destructuredAssignSynthesis(parent, i, child)
}
final override predicate location(AstNode n, Location l) {
exists(TupleAssignExpr tae, StmtSequence seq | seq = tae.getDesugared() |
exists(DestructuredAssignExpr tae, StmtSequence seq | seq = tae.getDesugared() |
n = seq.getStmt(0) and
hasLocation(tae.getRightOperand(), l)
or
exists(Pattern p, int j |
p = tae.getElement(j) and
exists(AstNode elem, int j |
elem = tae.getElement(j) and
n = seq.getStmt(j + 1) and
hasLocation(p, l)
hasLocation(elem, l)
)
)
}
final override predicate localVariable(AstNode n, int i) {
n instanceof TupleAssignExpr and
n instanceof DestructuredAssignExpr and
i = 0
}
@@ -784,10 +784,6 @@ private module CompoundAssignDesugar {
setter = false and
arity = 1
}
final override predicate excludeFromControlFlowTree(AstNode n) {
n = any(TupleAssignExpr tae).getTuplePattern()
}
}
}
@@ -820,7 +816,7 @@ private module ArrayLiteralDesugar {
* ::Array.[](1, 2, 3)
* ```
*/
private class CompoundAssignSynthesis extends Synthesis {
private class ArrayLiteralSynthesis extends Synthesis {
final override predicate child(AstNode parent, int i, Child child) {
arrayLiteralSynthesis(parent, i, child)
}

View File

@@ -935,6 +935,10 @@ module Trees {
}
}
private class DestructuredParameterTree extends StandardPostOrderTree, DestructuredParameter {
final override ControlFlowTree getChildElement(int i) { result = this.getElement(i) }
}
private class DesugaredTree extends ControlFlowTree {
ControlFlowTree desugared;
@@ -1381,10 +1385,6 @@ module Trees {
}
}
private class TuplePatternTree extends StandardPostOrderTree, TuplePattern {
final override ControlFlowTree getChildElement(int i) { result = this.getElement(i) }
}
private class UndefStmtTree extends StandardPreOrderTree, UndefStmt {
final override ControlFlowTree getChildElement(int i) { result = this.getMethodName(i) }
}

View File

@@ -400,7 +400,7 @@ private DataFlow::LocalSourceNode trackModule(Module tp, TypeTracker t) {
t.start() and
(
// ConstantReadAccess to Module
resolveScopeExpr(result.asExpr().getExpr()) = tp
resolveConstantReadAccess(result.asExpr().getExpr()) = tp
or
// `self` reference to Module
result = selfInModule(tp)

View File

@@ -61,6 +61,12 @@ class CallNode extends LocalSourceNode {
/** Gets the name of the the method called by the method call (if any) corresponding to this data-flow node */
string getMethodName() { result = node.getExpr().(MethodCall).getMethodName() }
/** Gets the number of arguments of this call. */
int getNumberOfArguments() { result = node.getNumberOfArguments() }
/** Gets the block of this call. */
Node getBlock() { result.asExpr() = node.getBlock() }
}
/**

View File

@@ -43,7 +43,7 @@ class ActionControllerControllerClass extends ClassDeclaration {
or
// class BarController < FooController
exists(ActionControllerControllerClass other |
other.getModule() = resolveScopeExpr(this.getSuperclassExpr())
other.getModule() = resolveConstantReadAccess(this.getSuperclassExpr())
)
}
@@ -54,13 +54,13 @@ class ActionControllerControllerClass extends ClassDeclaration {
}
/**
* An instance method defined within an `ActionController` controller class.
* A public instance method defined within an `ActionController` controller class.
* This may be the target of a route handler, if such a route is defined.
*/
class ActionControllerActionMethod extends Method, HTTP::Server::RequestHandler::Range {
private ActionControllerControllerClass controllerClass;
ActionControllerActionMethod() { this = controllerClass.getAMethod() }
ActionControllerActionMethod() { this = controllerClass.getAMethod() and not this.isPrivate() }
/**
* Establishes a mapping between a method within the file
@@ -118,6 +118,28 @@ class ParamsSource extends RemoteFlowSource::Range {
override string getSourceType() { result = "ActionController::Metal#params" }
}
/**
* A call to the `cookies` method to fetch the request parameters.
*/
abstract class CookiesCall extends MethodCall {
CookiesCall() { this.getMethodName() = "cookies" }
}
/**
* A `RemoteFlowSource::Range` to represent accessing the
* ActionController parameters available via the `cookies` method.
*/
class CookiesSource extends RemoteFlowSource::Range {
CookiesCall call;
CookiesSource() { this.asExpr().getExpr() = call }
override string getSourceType() { result = "ActionController::Metal#cookies" }
}
// A call to `cookies` from within a controller.
private class ActionControllerCookiesCall extends ActionControllerContextCall, CookiesCall { }
// A call to `params` from within a controller.
private class ActionControllerParamsCall extends ActionControllerContextCall, ParamsCall { }

View File

@@ -66,6 +66,9 @@ class RawCall extends ActionViewContextCall {
// A call to the `params` method within the context of a template.
private class ActionViewParamsCall extends ActionViewContextCall, ParamsCall { }
// A call to the `cookies` method within the context of a template.
private class ActionViewCookiesCall extends ActionViewContextCall, CookiesCall { }
/**
* A call to a `render` method that will populate the response body with the
* rendered content.

View File

@@ -59,7 +59,7 @@ class ActiveRecordModelClass extends ClassDeclaration {
or
// class Bar < Foo
exists(ActiveRecordModelClass other |
other.getModule() = resolveScopeExpr(this.getSuperclassExpr())
other.getModule() = resolveConstantReadAccess(this.getSuperclassExpr())
)
}
@@ -101,7 +101,7 @@ class ActiveRecordModelClassMethodCall extends MethodCall {
ActiveRecordModelClassMethodCall() {
// e.g. Foo.where(...)
recvCls.getModule() = resolveScopeExpr(this.getReceiver())
recvCls.getModule() = resolveConstantReadAccess(this.getReceiver())
or
// e.g. Foo.joins(:bars).where(...)
recvCls = this.getReceiver().(ActiveRecordModelClassMethodCall).getReceiverClass()

View File

@@ -28,7 +28,9 @@ private class RailtieClassAccess extends ConstantReadAccess {
private class RailtieClass extends ClassDeclaration {
RailtieClass() {
this.getSuperclassExpr() instanceof RailtieClassAccess or
exists(RailtieClass other | other.getModule() = resolveScopeExpr(this.getSuperclassExpr()))
exists(RailtieClass other |
other.getModule() = resolveConstantReadAccess(this.getSuperclassExpr())
)
}
}
@@ -39,7 +41,7 @@ private DataFlow::CallNode getAConfigureCallNode() {
// `Rails::Application.configure`
exists(ConstantReadAccess read, RailtieClass cls |
read = result.getReceiver().asExpr().getExpr() and
resolveScopeExpr(read) = cls.getModule() and
resolveConstantReadAccess(read) = cls.getModule() and
result.asExpr().getExpr().(MethodCall).getMethodName() = "configure"
)
}
@@ -68,7 +70,7 @@ private class ConfigSourceNode extends DataFlow::LocalSourceNode {
configCall = this.asExpr().getExpr()
|
configureCallNode = getAConfigureCallNode() and
block = configureCallNode.asExpr().getExpr().(MethodCall).getBlock() and
block = configureCallNode.getBlock().asExpr().getExpr() and
configCall.getParent+() = block and
configCall.getMethodName() = "config"
)
@@ -84,8 +86,6 @@ private class CallAgainstConfig extends DataFlow::CallNode {
CallAgainstConfig() { this.getReceiver() instanceof ConfigNode }
MethodCall getCall() { result = this.asExpr().getExpr() }
Block getBlock() { result = this.getCall().getBlock() }
}
private class ActionControllerConfigNode extends DataFlow::Node {

View File

@@ -26,8 +26,6 @@ class KernelMethodCall extends DataFlow::CallNode {
)
)
}
int getNumberOfArguments() { result = methodCall.getNumberOfArguments() }
}
/**

View File

@@ -1,5 +1,6 @@
name: codeql/ruby-all
version: 0.0.2
version: 0.0.5-dev
groups: ruby
extractor: ruby
dbscheme: ruby.dbscheme
upgrades: upgrades

10
ruby/ql/src/CHANGELOG.md Normal file
View File

@@ -0,0 +1,10 @@
## 0.0.4
### New Queries
* A new query (`rb/request-forgery`) has been added. The query finds HTTP requests made with user-controlled URLs.
* A new query (`rb/csrf-protection-disabled`) has been added. The query finds cases where cross-site forgery protection is explictly disabled.
### Query Metadata Changes
* The precision of "Hard-coded credentials" (`rb/hardcoded-credentials`) has been decreased from "high" to "medium". This query will no longer be run and displayed by default on Code Scanning and LGTM.

View File

@@ -0,0 +1,10 @@
## 0.0.4
### New Queries
* A new query (`rb/request-forgery`) has been added. The query finds HTTP requests made with user-controlled URLs.
* A new query (`rb/csrf-protection-disabled`) has been added. The query finds cases where cross-site forgery protection is explictly disabled.
### Query Metadata Changes
* The precision of "Hard-coded credentials" (`rb/hardcoded-credentials`) has been decreased from "high" to "medium". This query will no longer be run and displayed by default on Code Scanning and LGTM.

View File

@@ -0,0 +1,2 @@
---
lastReleaseVersion: 0.0.4

View File

@@ -1,5 +1,6 @@
name: codeql/ruby-queries
version: 0.0.2
version: 0.0.5-dev
groups: ruby
suites: codeql-suites
defaultSuiteFile: codeql-suites/ruby-code-scanning.qls
dependencies:

View File

@@ -559,7 +559,7 @@ calls/calls.rb:
# 315| getArgument: [IntegerLiteral] 0
# 315| getAnOperand/getRightOperand: [IntegerLiteral] 10
# 316| getStmt: [AssignExpr] ... = ...
# 316| getLeftOperand: [TuplePattern] (..., ...)
# 316| getAnOperand/getLeftOperand: [DestructuredLhsExpr] (..., ...)
# 316| getElement: [MethodCall] call to foo
# 316| getReceiver: [Self, SelfVariableAccess] self
# 316| getElement: [MethodCall] call to bar
@@ -574,7 +574,7 @@ calls/calls.rb:
# 316| getElement: [IntegerLiteral] 3
# 316| getElement: [IntegerLiteral] 4
# 317| getStmt: [AssignExpr] ... = ...
# 317| getLeftOperand: [TuplePattern] (..., ...)
# 317| getAnOperand/getLeftOperand: [DestructuredLhsExpr] (..., ...)
# 317| getElement: [LocalVariableAccess] a
# 317| getElement: [ElementReference] ...[...]
# 317| getReceiver: [MethodCall] call to foo
@@ -654,7 +654,7 @@ calls/calls.rb:
# 336| getArgument: [LocalVariableAccess] b
# 336| getArgument: [ForwardedArguments] ...
# 340| getStmt: [ForExpr] for ... in ...
# 340| getPattern: [TuplePattern] (..., ...)
# 340| getPattern: [DestructuredLhsExpr] (..., ...)
# 340| getElement: [LocalVariableAccess] x
# 340| getElement: [LocalVariableAccess] y
# 340| getElement: [LocalVariableAccess] z
@@ -1845,7 +1845,7 @@ control/loops.rb:
# 18| getAnOperand/getLeftOperand: [LocalVariableAccess] foo
# 18| getAnOperand/getRightOperand: [LocalVariableAccess] n
# 22| getStmt: [ForExpr] for ... in ...
# 22| getPattern: [TuplePattern] (..., ...)
# 22| getPattern: [DestructuredLhsExpr] (..., ...)
# 22| getElement: [LocalVariableAccess] key
# 22| getElement: [LocalVariableAccess] value
# 22| getValue: [HashLiteral] {...}
@@ -1863,7 +1863,7 @@ control/loops.rb:
# 24| getAnOperand/getLeftOperand: [LocalVariableAccess] foo
# 24| getAnOperand/getRightOperand: [LocalVariableAccess] value
# 28| getStmt: [ForExpr] for ... in ...
# 28| getPattern: [TuplePattern] (..., ...)
# 28| getPattern: [DestructuredLhsExpr] (..., ...)
# 28| getElement: [LocalVariableAccess] key
# 28| getElement: [LocalVariableAccess] value
# 28| getValue: [HashLiteral] {...}
@@ -2367,7 +2367,7 @@ params/params.rb:
# 14| getAnOperand/getLeftOperand/getReceiver: [LocalVariableAccess] foo
# 14| getAnOperand/getArgument/getRightOperand: [LocalVariableAccess] bar
# 17| getStmt: [Method] destructured_method_param
# 17| getParameter: [TuplePatternParameter] (..., ...)
# 17| getParameter: [DestructuredParameter] (..., ...)
# 17| getElement: [LocalVariableAccess] a
# 17| getElement: [LocalVariableAccess] b
# 17| getElement: [LocalVariableAccess] c
@@ -2377,7 +2377,7 @@ params/params.rb:
# 22| getStmt: [MethodCall] call to each
# 22| getReceiver: [LocalVariableAccess] array
# 22| getBlock: [BraceBlock] { ... }
# 22| getParameter: [TuplePatternParameter] (..., ...)
# 22| getParameter: [DestructuredParameter] (..., ...)
# 22| getElement: [LocalVariableAccess] a
# 22| getElement: [LocalVariableAccess] b
# 22| getStmt: [MethodCall] call to puts
@@ -2388,10 +2388,10 @@ params/params.rb:
# 25| getStmt: [AssignExpr] ... = ...
# 25| getAnOperand/getLeftOperand: [LocalVariableAccess] sum_four_values
# 25| getAnOperand/getRightOperand: [Lambda] -> { ... }
# 25| getParameter: [TuplePatternParameter] (..., ...)
# 25| getParameter: [DestructuredParameter] (..., ...)
# 25| getElement: [LocalVariableAccess] first
# 25| getElement: [LocalVariableAccess] second
# 25| getParameter: [TuplePatternParameter] (..., ...)
# 25| getParameter: [DestructuredParameter] (..., ...)
# 25| getElement: [LocalVariableAccess] third
# 25| getElement: [LocalVariableAccess] fourth
# 26| getStmt: [AddExpr] ... + ...

View File

@@ -245,7 +245,7 @@ calls/calls.rb:
# 340| getAnOperand/getRightOperand: [MethodCall] call to []
# 340| getArgument: [IntegerLiteral] 2
# 340| getReceiver: [LocalVariableAccess] __synth__0__1
# 340| getLeftOperand: [TuplePattern] (..., ...)
# 340| getAnOperand/getLeftOperand: [DestructuredLhsExpr] (..., ...)
# 341| getStmt: [MethodCall] call to foo
# 341| getReceiver: [Self, SelfVariableAccess] self
# 341| getArgument: [LocalVariableAccess] x
@@ -477,7 +477,7 @@ control/loops.rb:
# 22| getAnOperand/getRightOperand: [MethodCall] call to []
# 22| getArgument: [IntegerLiteral] 1
# 22| getReceiver: [LocalVariableAccess] __synth__0__1
# 22| getLeftOperand: [TuplePattern] (..., ...)
# 22| getAnOperand/getLeftOperand: [DestructuredLhsExpr] (..., ...)
# 23| getStmt: [AssignAddExpr] ... += ...
# 23| getDesugared: [AssignExpr] ... = ...
# 23| getAnOperand/getLeftOperand: [LocalVariableAccess] sum
@@ -518,7 +518,7 @@ control/loops.rb:
# 28| getAnOperand/getRightOperand: [MethodCall] call to []
# 28| getArgument: [IntegerLiteral] 1
# 28| getReceiver: [LocalVariableAccess] __synth__0__1
# 28| getLeftOperand: [TuplePattern] (..., ...)
# 28| getAnOperand/getLeftOperand: [DestructuredLhsExpr] (..., ...)
# 29| getStmt: [AssignAddExpr] ... += ...
# 29| getDesugared: [AssignExpr] ... = ...
# 29| getAnOperand/getLeftOperand: [LocalVariableAccess] sum

View File

@@ -13,13 +13,13 @@ query predicate conditionalLoops(
cond = l.getCondition()
}
query predicate forExprs(ForExpr f, Pattern p, StmtSequence body, int i, Stmt bodyChild) {
query predicate forExprs(ForExpr f, LhsExpr p, StmtSequence body, int i, Stmt bodyChild) {
p = f.getPattern() and
body = f.getBody() and
bodyChild = body.getStmt(i)
}
query predicate forExprsTuplePatterns(ForExpr f, TuplePattern tp, int i, Pattern cp) {
query predicate forExprsTuplePatterns(ForExpr f, DestructuredLhsExpr tp, int i, Expr cp) {
tp = f.getPattern() and
cp = tp.getElement(i)
}

View File

@@ -73,7 +73,7 @@ paramsInMethods
| params.rb:4:1:5:3 | identifier_method_params | 0 | params.rb:4:30:4:32 | foo | SimpleParameter |
| params.rb:4:1:5:3 | identifier_method_params | 1 | params.rb:4:35:4:37 | bar | SimpleParameter |
| params.rb:4:1:5:3 | identifier_method_params | 2 | params.rb:4:40:4:42 | baz | SimpleParameter |
| params.rb:17:1:18:3 | destructured_method_param | 0 | params.rb:17:31:17:39 | (..., ...) | TuplePatternParameter |
| params.rb:17:1:18:3 | destructured_method_param | 0 | params.rb:17:31:17:39 | (..., ...) | DestructuredParameter |
| params.rb:30:1:31:3 | method_with_splat | 0 | params.rb:30:23:30:28 | wibble | SimpleParameter |
| params.rb:30:1:31:3 | method_with_splat | 1 | params.rb:30:31:30:36 | *splat | SplatParameter |
| params.rb:30:1:31:3 | method_with_splat | 2 | params.rb:30:39:30:52 | **double_splat | HashSplatParameter |
@@ -90,7 +90,7 @@ paramsInMethods
paramsInBlocks
| params.rb:9:11:11:3 | do ... end | 0 | params.rb:9:15:9:17 | key | SimpleParameter |
| params.rb:9:11:11:3 | do ... end | 1 | params.rb:9:20:9:24 | value | SimpleParameter |
| params.rb:22:12:22:32 | { ... } | 0 | params.rb:22:15:22:20 | (..., ...) | TuplePatternParameter |
| params.rb:22:12:22:32 | { ... } | 0 | params.rb:22:15:22:20 | (..., ...) | DestructuredParameter |
| params.rb:34:12:35:3 | do ... end | 0 | params.rb:34:16:34:18 | val | SimpleParameter |
| params.rb:34:12:35:3 | do ... end | 1 | params.rb:34:21:34:26 | *splat | SplatParameter |
| params.rb:34:12:35:3 | do ... end | 2 | params.rb:34:29:34:42 | **double_splat | HashSplatParameter |
@@ -103,8 +103,8 @@ paramsInBlocks
paramsInLambdas
| params.rb:14:7:14:33 | -> { ... } | 0 | params.rb:14:11:14:13 | foo | SimpleParameter |
| params.rb:14:7:14:33 | -> { ... } | 1 | params.rb:14:16:14:18 | bar | SimpleParameter |
| params.rb:25:19:27:1 | -> { ... } | 0 | params.rb:25:23:25:37 | (..., ...) | TuplePatternParameter |
| params.rb:25:19:27:1 | -> { ... } | 1 | params.rb:25:40:25:54 | (..., ...) | TuplePatternParameter |
| params.rb:25:19:27:1 | -> { ... } | 0 | params.rb:25:23:25:37 | (..., ...) | DestructuredParameter |
| params.rb:25:19:27:1 | -> { ... } | 1 | params.rb:25:40:25:54 | (..., ...) | DestructuredParameter |
| params.rb:38:22:38:47 | -> { ... } | 0 | params.rb:38:26:38:26 | x | SimpleParameter |
| params.rb:38:22:38:47 | -> { ... } | 1 | params.rb:38:29:38:33 | *blah | SplatParameter |
| params.rb:38:22:38:47 | -> { ... } | 2 | params.rb:38:36:38:43 | **wibble | HashSplatParameter |
@@ -122,10 +122,10 @@ params
| params.rb:9:20:9:24 | value | 1 | SimpleParameter |
| params.rb:14:11:14:13 | foo | 0 | SimpleParameter |
| params.rb:14:16:14:18 | bar | 1 | SimpleParameter |
| params.rb:17:31:17:39 | (..., ...) | 0 | TuplePatternParameter |
| params.rb:22:15:22:20 | (..., ...) | 0 | TuplePatternParameter |
| params.rb:25:23:25:37 | (..., ...) | 0 | TuplePatternParameter |
| params.rb:25:40:25:54 | (..., ...) | 1 | TuplePatternParameter |
| params.rb:17:31:17:39 | (..., ...) | 0 | DestructuredParameter |
| params.rb:22:15:22:20 | (..., ...) | 0 | DestructuredParameter |
| params.rb:25:23:25:37 | (..., ...) | 0 | DestructuredParameter |
| params.rb:25:40:25:54 | (..., ...) | 1 | DestructuredParameter |
| params.rb:30:23:30:28 | wibble | 0 | SimpleParameter |
| params.rb:30:31:30:36 | *splat | 1 | SplatParameter |
| params.rb:30:39:30:52 | **double_splat | 2 | HashSplatParameter |

View File

@@ -6,7 +6,7 @@ query predicate idParams(NamedParameter np, string name) { name = np.getName() }
query predicate blockParams(BlockParameter bp, string name) { name = bp.getName() }
query predicate patternParams(TuplePatternParameter tpp, Pattern child, int childIndex) {
query predicate patternParams(DestructuredParameter tpp, AstNode child, int childIndex) {
tpp.getElement(childIndex) = child
}

View File

@@ -1941,12 +1941,12 @@ cfg.rb:
# 62| call to []
#-----| -> * ...
# 62| ...
#-----| -> ...
# 62| 1
#-----| -> call to []
# 62| ...
#-----| -> ...
# 62| __synth__0
#-----| -> 1
@@ -3626,12 +3626,12 @@ desugar.rb:
# 22| call to []
#-----| -> ... = ...
# 22| ...
#-----| -> ...
# 22| -1
#-----| -> call to []
# 22| ...
#-----| -> ...
# 22| __synth__0
#-----| -> -1
@@ -3706,12 +3706,12 @@ desugar.rb:
# 26| call to []
#-----| -> * ...
# 26| ...
#-----| -> ...
# 26| 1
#-----| -> call to []
# 26| ...
#-----| -> ...
# 26| __synth__0
#-----| -> 1

View File

@@ -2,15 +2,15 @@ actionControllerControllerClasses
| ActiveRecordInjection.rb:27:1:58:3 | FooController |
| ActiveRecordInjection.rb:60:1:90:3 | BarController |
| ActiveRecordInjection.rb:92:1:96:3 | BazController |
| app/controllers/foo/bars_controller.rb:1:1:20:3 | BarsController |
| app/controllers/foo/bars_controller.rb:3:1:31:3 | BarsController |
actionControllerActionMethods
| ActiveRecordInjection.rb:32:3:57:5 | some_request_handler |
| ActiveRecordInjection.rb:61:3:69:5 | some_other_request_handler |
| ActiveRecordInjection.rb:71:3:89:5 | safe_paths |
| ActiveRecordInjection.rb:93:3:95:5 | yet_another_handler |
| app/controllers/foo/bars_controller.rb:3:3:5:5 | index |
| app/controllers/foo/bars_controller.rb:7:3:13:5 | show_debug |
| app/controllers/foo/bars_controller.rb:15:3:19:5 | show |
| app/controllers/foo/bars_controller.rb:5:3:7:5 | index |
| app/controllers/foo/bars_controller.rb:9:3:18:5 | show_debug |
| app/controllers/foo/bars_controller.rb:20:3:24:5 | show |
paramsCalls
| ActiveRecordInjection.rb:35:30:35:35 | call to params |
| ActiveRecordInjection.rb:39:29:39:34 | call to params |
@@ -25,10 +25,10 @@ paramsCalls
| ActiveRecordInjection.rb:83:12:83:17 | call to params |
| ActiveRecordInjection.rb:88:15:88:20 | call to params |
| ActiveRecordInjection.rb:94:21:94:26 | call to params |
| app/controllers/foo/bars_controller.rb:8:21:8:26 | call to params |
| app/controllers/foo/bars_controller.rb:9:10:9:15 | call to params |
| app/controllers/foo/bars_controller.rb:16:21:16:26 | call to params |
| app/controllers/foo/bars_controller.rb:17:10:17:15 | call to params |
| app/controllers/foo/bars_controller.rb:13:21:13:26 | call to params |
| app/controllers/foo/bars_controller.rb:14:10:14:15 | call to params |
| app/controllers/foo/bars_controller.rb:21:21:21:26 | call to params |
| app/controllers/foo/bars_controller.rb:22:10:22:15 | call to params |
| app/views/foo/bars/show.html.erb:5:9:5:14 | call to params |
paramsSources
| ActiveRecordInjection.rb:35:30:35:35 | call to params |
@@ -44,17 +44,21 @@ paramsSources
| ActiveRecordInjection.rb:83:12:83:17 | call to params |
| ActiveRecordInjection.rb:88:15:88:20 | call to params |
| ActiveRecordInjection.rb:94:21:94:26 | call to params |
| app/controllers/foo/bars_controller.rb:8:21:8:26 | call to params |
| app/controllers/foo/bars_controller.rb:9:10:9:15 | call to params |
| app/controllers/foo/bars_controller.rb:16:21:16:26 | call to params |
| app/controllers/foo/bars_controller.rb:17:10:17:15 | call to params |
| app/controllers/foo/bars_controller.rb:13:21:13:26 | call to params |
| app/controllers/foo/bars_controller.rb:14:10:14:15 | call to params |
| app/controllers/foo/bars_controller.rb:21:21:21:26 | call to params |
| app/controllers/foo/bars_controller.rb:22:10:22:15 | call to params |
| app/views/foo/bars/show.html.erb:5:9:5:14 | call to params |
cookiesCalls
| app/controllers/foo/bars_controller.rb:10:27:10:33 | call to cookies |
cookiesSources
| app/controllers/foo/bars_controller.rb:10:27:10:33 | call to cookies |
redirectToCalls
| app/controllers/foo/bars_controller.rb:12:5:12:30 | call to redirect_to |
| app/controllers/foo/bars_controller.rb:17:5:17:30 | call to redirect_to |
actionControllerHelperMethods
getAssociatedControllerClasses
| app/controllers/foo/bars_controller.rb:1:1:20:3 | BarsController | app/views/foo/bars/_widget.html.erb:0:0:0:0 | app/views/foo/bars/_widget.html.erb |
| app/controllers/foo/bars_controller.rb:1:1:20:3 | BarsController | app/views/foo/bars/show.html.erb:0:0:0:0 | app/views/foo/bars/show.html.erb |
| app/controllers/foo/bars_controller.rb:3:1:31:3 | BarsController | app/views/foo/bars/_widget.html.erb:0:0:0:0 | app/views/foo/bars/_widget.html.erb |
| app/controllers/foo/bars_controller.rb:3:1:31:3 | BarsController | app/views/foo/bars/show.html.erb:0:0:0:0 | app/views/foo/bars/show.html.erb |
controllerTemplateFiles
| app/controllers/foo/bars_controller.rb:1:1:20:3 | BarsController | app/views/foo/bars/_widget.html.erb:0:0:0:0 | app/views/foo/bars/_widget.html.erb |
| app/controllers/foo/bars_controller.rb:1:1:20:3 | BarsController | app/views/foo/bars/show.html.erb:0:0:0:0 | app/views/foo/bars/show.html.erb |
| app/controllers/foo/bars_controller.rb:3:1:31:3 | BarsController | app/views/foo/bars/_widget.html.erb:0:0:0:0 | app/views/foo/bars/_widget.html.erb |
| app/controllers/foo/bars_controller.rb:3:1:31:3 | BarsController | app/views/foo/bars/show.html.erb:0:0:0:0 | app/views/foo/bars/show.html.erb |

View File

@@ -10,6 +10,10 @@ query predicate paramsCalls(ParamsCall c) { any() }
query predicate paramsSources(ParamsSource src) { any() }
query predicate cookiesCalls(CookiesCall c) { any() }
query predicate cookiesSources(CookiesSource src) { any() }
query predicate redirectToCalls(RedirectToCall c) { any() }
query predicate actionControllerHelperMethods(ActionControllerHelperMethod m) { any() }

View File

@@ -12,10 +12,11 @@ rawCalls
| app/views/foo/bars/show.html.erb:5:5:5:21 | call to raw |
| app/views/foo/bars/show.html.erb:7:5:7:19 | call to raw |
renderCalls
| app/controllers/foo/bars_controller.rb:4:5:4:37 | call to render |
| app/controllers/foo/bars_controller.rb:18:5:18:76 | call to render |
| app/controllers/foo/bars_controller.rb:6:5:6:37 | call to render |
| app/controllers/foo/bars_controller.rb:23:5:23:76 | call to render |
| app/controllers/foo/bars_controller.rb:29:5:29:17 | call to render |
| app/views/foo/bars/show.html.erb:31:5:31:89 | call to render |
renderToCalls
| app/controllers/foo/bars_controller.rb:10:16:10:97 | call to render_to_string |
| app/controllers/foo/bars_controller.rb:15:16:15:97 | call to render_to_string |
linkToCalls
| app/views/foo/bars/show.html.erb:33:5:33:41 | call to link_to |

View File

@@ -1,3 +1,5 @@
require 'json'
class BarsController < ApplicationController
def index
@@ -5,6 +7,9 @@ class BarsController < ApplicationController
end
def show_debug
user_info = JSON.load cookies[:user_info]
puts "User: #{user_info['name']}"
@user_website = params[:website]
dt = params[:text]
rendered = render_to_string "foo/bars/show", locals: { display_text: dt, safe_text: "hello" }
@@ -17,4 +22,10 @@ class BarsController < ApplicationController
dt = params[:text]
render "foo/bars/show", locals: { display_text: dt, safe_text: "hello" }
end
private
def unreachable_action
render "show"
end
end

View File

@@ -13,6 +13,7 @@ calls.rb:
# 97| Object
#-----| include -> Kernel
#-----| super -> BasicObject
#-----| prepend -> A
# 106| Array
#-----| super -> Object
@@ -49,12 +50,10 @@ calls.rb:
# 15| M
private.rb:
# 1| C
# 29| C
#-----| super -> Object
#-----| include -> M
calls.rb:
# 51| D
#-----| super -> C
@@ -66,6 +65,8 @@ calls.rb:
# 150| A
#-----| super -> S
#-----| super -> B
#-----| prepend -> A::B
# 155| B
#-----| super -> S
@@ -110,6 +111,13 @@ modules.rb:
# 115| XX
private.rb:
# 1| E
#-----| super -> Object
# 42| F
modules.rb:
# 5| Foo::Bar
# 19| Foo::ClassInFoo
@@ -134,6 +142,14 @@ modules.rb:
# 71| Test::Foo2::Foo2
modules_rec.rb:
# 1| B::A
#-----| super -> Object
# 4| A::B
#-----| super -> Object
modules.rb:
# 108| MM::MM
# 49| Foo::Bar::ClassInAnotherDefinitionOfFooBar

View File

@@ -75,16 +75,21 @@ getTarget
| modules.rb:90:24:90:36 | call to prepend | calls.rb:93:5:93:20 | prepend |
| modules.rb:96:3:96:14 | call to include | calls.rb:92:5:92:20 | include |
| modules.rb:102:3:102:16 | call to prepend | calls.rb:93:5:93:20 | prepend |
| modules_rec.rb:8:3:8:11 | call to prepend | calls.rb:93:5:93:20 | prepend |
| modules_rec.rb:11:1:11:9 | call to prepend | calls.rb:93:5:93:20 | prepend |
| private.rb:2:3:3:5 | call to private | calls.rb:94:5:94:20 | private |
| private.rb:10:3:10:19 | call to private | calls.rb:94:5:94:20 | private |
| private.rb:12:3:12:9 | call to private | calls.rb:94:5:94:20 | private |
| private.rb:24:1:24:5 | call to new | calls.rb:99:5:99:16 | new |
| private.rb:25:1:25:5 | call to new | calls.rb:99:5:99:16 | new |
| private.rb:26:1:26:5 | call to new | calls.rb:99:5:99:16 | new |
| private.rb:27:1:27:5 | call to new | calls.rb:99:5:99:16 | new |
| private.rb:28:1:28:5 | call to new | calls.rb:99:5:99:16 | new |
| private.rb:28:1:28:12 | call to public | private.rb:5:3:6:5 | public |
| private.rb:30:1:30:15 | call to private_on_main | private.rb:21:1:22:3 | private_on_main |
| private.rb:34:1:34:5 | call to new | calls.rb:99:5:99:16 | new |
| private.rb:35:1:35:5 | call to new | calls.rb:99:5:99:16 | new |
| private.rb:36:1:36:5 | call to new | calls.rb:99:5:99:16 | new |
| private.rb:37:1:37:5 | call to new | calls.rb:99:5:99:16 | new |
| private.rb:38:1:38:5 | call to new | calls.rb:99:5:99:16 | new |
| private.rb:38:1:38:12 | call to public | private.rb:5:3:6:5 | public |
| private.rb:40:1:40:15 | call to private_on_main | private.rb:31:1:32:3 | private_on_main |
| private.rb:43:3:44:5 | call to private | calls.rb:94:5:94:20 | private |
| private.rb:51:3:51:19 | call to private | calls.rb:94:5:94:20 | private |
| private.rb:53:3:53:9 | call to private | calls.rb:94:5:94:20 | private |
unresolvedCall
| calls.rb:19:5:19:14 | call to instance_m |
| calls.rb:20:5:20:19 | call to instance_m |
@@ -110,10 +115,12 @@ unresolvedCall
| hello.rb:20:16:20:26 | ... + ... |
| hello.rb:20:16:20:34 | ... + ... |
| hello.rb:20:16:20:40 | ... + ... |
| private.rb:24:1:24:14 | call to private1 |
| private.rb:25:1:25:14 | call to private2 |
| private.rb:26:1:26:14 | call to private3 |
| private.rb:27:1:27:14 | call to private4 |
| private.rb:23:3:24:5 | call to private_class_method |
| private.rb:28:3:28:32 | call to private_class_method |
| private.rb:34:1:34:14 | call to private1 |
| private.rb:35:1:35:14 | call to private2 |
| private.rb:36:1:36:14 | call to private3 |
| private.rb:37:1:37:14 | call to private4 |
privateMethod
| calls.rb:1:1:3:3 | foo |
| calls.rb:62:1:65:3 | optional_arg |
@@ -126,4 +133,10 @@ privateMethod
| private.rb:8:3:9:5 | private2 |
| private.rb:14:3:15:5 | private3 |
| private.rb:17:3:18:5 | private4 |
| private.rb:21:1:22:3 | private_on_main |
| private.rb:23:24:24:5 | private5 |
| private.rb:26:3:27:5 | private6 |
| private.rb:31:1:32:3 | private_on_main |
| private.rb:43:11:44:5 | private1 |
| private.rb:49:3:50:5 | private2 |
| private.rb:55:3:56:5 | private3 |
| private.rb:58:3:59:5 | private4 |

View File

@@ -4,4 +4,4 @@ query Callable getTarget(Call call) { result = call.getATarget() }
query predicate unresolvedCall(Call call) { not exists(call.getATarget()) }
query predicate privateMethod(Method m) { m.isPrivate() }
query predicate privateMethod(MethodBase m) { m.isPrivate() }

View File

@@ -1,5 +1,6 @@
getMethod
| calls.rb:15:1:24:3 | M | instance_m | calls.rb:16:5:16:23 | instance_m |
| calls.rb:29:1:44:3 | C | baz | calls.rb:37:5:43:7 | baz |
| calls.rb:51:1:55:3 | D | baz | calls.rb:52:5:54:7 | baz |
| calls.rb:77:1:80:3 | Integer | abs | calls.rb:79:5:79:16 | abs |
| calls.rb:77:1:80:3 | Integer | bit_length | calls.rb:78:5:78:23 | bit_length |
@@ -17,7 +18,7 @@ getMethod
| calls.rb:97:1:100:3 | Object | new | calls.rb:99:5:99:16 | new |
| calls.rb:97:1:100:3 | Object | optional_arg | calls.rb:62:1:65:3 | optional_arg |
| calls.rb:97:1:100:3 | Object | private_on_main | calls.rb:164:1:165:3 | private_on_main |
| calls.rb:97:1:100:3 | Object | private_on_main | private.rb:21:1:22:3 | private_on_main |
| calls.rb:97:1:100:3 | Object | private_on_main | private.rb:31:1:32:3 | private_on_main |
| calls.rb:102:1:104:3 | Hash | [] | calls.rb:103:5:103:15 | [] |
| calls.rb:106:1:117:3 | Array | [] | calls.rb:107:3:107:13 | [] |
| calls.rb:106:1:117:3 | Array | foreach | calls.rb:110:3:116:5 | foreach |
@@ -35,13 +36,28 @@ getMethod
| modules.rb:5:3:14:5 | Foo::Bar | method_in_foo_bar | modules.rb:9:5:10:7 | method_in_foo_bar |
| modules.rb:37:1:46:3 | Bar | method_a | modules.rb:38:3:39:5 | method_a |
| modules.rb:37:1:46:3 | Bar | method_b | modules.rb:41:3:42:5 | method_b |
| private.rb:1:1:19:3 | C | baz | calls.rb:37:5:43:7 | baz |
| private.rb:1:1:19:3 | C | private2 | private.rb:8:3:9:5 | private2 |
| private.rb:1:1:19:3 | C | private3 | private.rb:14:3:15:5 | private3 |
| private.rb:1:1:19:3 | C | private4 | private.rb:17:3:18:5 | private4 |
| private.rb:1:1:19:3 | C | public | private.rb:5:3:6:5 | public |
| private.rb:1:1:29:3 | E | private2 | private.rb:8:3:9:5 | private2 |
| private.rb:1:1:29:3 | E | private3 | private.rb:14:3:15:5 | private3 |
| private.rb:1:1:29:3 | E | private4 | private.rb:17:3:18:5 | private4 |
| private.rb:1:1:29:3 | E | public | private.rb:5:3:6:5 | public |
| private.rb:42:1:60:3 | F | private2 | private.rb:49:3:50:5 | private2 |
| private.rb:42:1:60:3 | F | private3 | private.rb:55:3:56:5 | private3 |
| private.rb:42:1:60:3 | F | private4 | private.rb:58:3:59:5 | private4 |
| private.rb:42:1:60:3 | F | public | private.rb:46:3:47:5 | public |
lookupMethod
| calls.rb:15:1:24:3 | M | instance_m | calls.rb:16:5:16:23 | instance_m |
| calls.rb:29:1:44:3 | C | baz | calls.rb:37:5:43:7 | baz |
| calls.rb:29:1:44:3 | C | call_block | calls.rb:67:1:69:3 | call_block |
| calls.rb:29:1:44:3 | C | foo | calls.rb:1:1:3:3 | foo |
| calls.rb:29:1:44:3 | C | foo | calls.rb:71:1:75:3 | foo |
| calls.rb:29:1:44:3 | C | funny | calls.rb:119:1:121:3 | funny |
| calls.rb:29:1:44:3 | C | indirect | calls.rb:137:1:139:3 | indirect |
| calls.rb:29:1:44:3 | C | instance_m | calls.rb:16:5:16:23 | instance_m |
| calls.rb:29:1:44:3 | C | new | calls.rb:99:5:99:16 | new |
| calls.rb:29:1:44:3 | C | optional_arg | calls.rb:62:1:65:3 | optional_arg |
| calls.rb:29:1:44:3 | C | private_on_main | calls.rb:164:1:165:3 | private_on_main |
| calls.rb:29:1:44:3 | C | puts | calls.rb:87:5:87:17 | puts |
| calls.rb:29:1:44:3 | C | to_s | calls.rb:151:5:152:7 | to_s |
| calls.rb:51:1:55:3 | D | baz | calls.rb:52:5:54:7 | baz |
| calls.rb:51:1:55:3 | D | call_block | calls.rb:67:1:69:3 | call_block |
| calls.rb:51:1:55:3 | D | foo | calls.rb:1:1:3:3 | foo |
@@ -51,16 +67,14 @@ lookupMethod
| calls.rb:51:1:55:3 | D | instance_m | calls.rb:16:5:16:23 | instance_m |
| calls.rb:51:1:55:3 | D | new | calls.rb:99:5:99:16 | new |
| calls.rb:51:1:55:3 | D | optional_arg | calls.rb:62:1:65:3 | optional_arg |
| calls.rb:51:1:55:3 | D | private2 | private.rb:8:3:9:5 | private2 |
| calls.rb:51:1:55:3 | D | private3 | private.rb:14:3:15:5 | private3 |
| calls.rb:51:1:55:3 | D | private4 | private.rb:17:3:18:5 | private4 |
| calls.rb:51:1:55:3 | D | private_on_main | calls.rb:164:1:165:3 | private_on_main |
| calls.rb:51:1:55:3 | D | public | private.rb:5:3:6:5 | public |
| calls.rb:51:1:55:3 | D | puts | calls.rb:87:5:87:17 | puts |
| calls.rb:51:1:55:3 | D | to_s | calls.rb:151:5:152:7 | to_s |
| calls.rb:77:1:80:3 | Integer | abs | calls.rb:79:5:79:16 | abs |
| calls.rb:77:1:80:3 | Integer | bit_length | calls.rb:78:5:78:23 | bit_length |
| calls.rb:77:1:80:3 | Integer | new | calls.rb:99:5:99:16 | new |
| calls.rb:77:1:80:3 | Integer | puts | calls.rb:87:5:87:17 | puts |
| calls.rb:77:1:80:3 | Integer | to_s | calls.rb:151:5:152:7 | to_s |
| calls.rb:82:1:84:3 | String | call_block | calls.rb:67:1:69:3 | call_block |
| calls.rb:82:1:84:3 | String | capitalize | calls.rb:83:5:83:23 | capitalize |
| calls.rb:82:1:84:3 | String | foo | calls.rb:1:1:3:3 | foo |
@@ -71,6 +85,7 @@ lookupMethod
| calls.rb:82:1:84:3 | String | optional_arg | calls.rb:62:1:65:3 | optional_arg |
| calls.rb:82:1:84:3 | String | private_on_main | calls.rb:164:1:165:3 | private_on_main |
| calls.rb:82:1:84:3 | String | puts | calls.rb:87:5:87:17 | puts |
| calls.rb:82:1:84:3 | String | to_s | calls.rb:151:5:152:7 | to_s |
| calls.rb:86:1:88:3 | Kernel | puts | calls.rb:87:5:87:17 | puts |
| calls.rb:90:1:95:3 | Module | call_block | calls.rb:67:1:69:3 | call_block |
| calls.rb:90:1:95:3 | Module | foo | calls.rb:1:1:3:3 | foo |
@@ -85,6 +100,7 @@ lookupMethod
| calls.rb:90:1:95:3 | Module | private | calls.rb:94:5:94:20 | private |
| calls.rb:90:1:95:3 | Module | private_on_main | calls.rb:164:1:165:3 | private_on_main |
| calls.rb:90:1:95:3 | Module | puts | calls.rb:87:5:87:17 | puts |
| calls.rb:90:1:95:3 | Module | to_s | calls.rb:151:5:152:7 | to_s |
| calls.rb:97:1:100:3 | Object | call_block | calls.rb:67:1:69:3 | call_block |
| calls.rb:97:1:100:3 | Object | foo | calls.rb:1:1:3:3 | foo |
| calls.rb:97:1:100:3 | Object | foo | calls.rb:71:1:75:3 | foo |
@@ -93,8 +109,9 @@ lookupMethod
| calls.rb:97:1:100:3 | Object | new | calls.rb:99:5:99:16 | new |
| calls.rb:97:1:100:3 | Object | optional_arg | calls.rb:62:1:65:3 | optional_arg |
| calls.rb:97:1:100:3 | Object | private_on_main | calls.rb:164:1:165:3 | private_on_main |
| calls.rb:97:1:100:3 | Object | private_on_main | private.rb:21:1:22:3 | private_on_main |
| calls.rb:97:1:100:3 | Object | private_on_main | private.rb:31:1:32:3 | private_on_main |
| calls.rb:97:1:100:3 | Object | puts | calls.rb:87:5:87:17 | puts |
| calls.rb:97:1:100:3 | Object | to_s | calls.rb:151:5:152:7 | to_s |
| calls.rb:102:1:104:3 | Hash | [] | calls.rb:103:5:103:15 | [] |
| calls.rb:102:1:104:3 | Hash | call_block | calls.rb:67:1:69:3 | call_block |
| calls.rb:102:1:104:3 | Hash | foo | calls.rb:1:1:3:3 | foo |
@@ -105,6 +122,7 @@ lookupMethod
| calls.rb:102:1:104:3 | Hash | optional_arg | calls.rb:62:1:65:3 | optional_arg |
| calls.rb:102:1:104:3 | Hash | private_on_main | calls.rb:164:1:165:3 | private_on_main |
| calls.rb:102:1:104:3 | Hash | puts | calls.rb:87:5:87:17 | puts |
| calls.rb:102:1:104:3 | Hash | to_s | calls.rb:151:5:152:7 | to_s |
| calls.rb:106:1:117:3 | Array | [] | calls.rb:107:3:107:13 | [] |
| calls.rb:106:1:117:3 | Array | call_block | calls.rb:67:1:69:3 | call_block |
| calls.rb:106:1:117:3 | Array | foo | calls.rb:1:1:3:3 | foo |
@@ -117,6 +135,7 @@ lookupMethod
| calls.rb:106:1:117:3 | Array | optional_arg | calls.rb:62:1:65:3 | optional_arg |
| calls.rb:106:1:117:3 | Array | private_on_main | calls.rb:164:1:165:3 | private_on_main |
| calls.rb:106:1:117:3 | Array | puts | calls.rb:87:5:87:17 | puts |
| calls.rb:106:1:117:3 | Array | to_s | calls.rb:151:5:152:7 | to_s |
| calls.rb:144:1:148:3 | S | call_block | calls.rb:67:1:69:3 | call_block |
| calls.rb:144:1:148:3 | S | foo | calls.rb:1:1:3:3 | foo |
| calls.rb:144:1:148:3 | S | foo | calls.rb:71:1:75:3 | foo |
@@ -127,6 +146,7 @@ lookupMethod
| calls.rb:144:1:148:3 | S | private_on_main | calls.rb:164:1:165:3 | private_on_main |
| calls.rb:144:1:148:3 | S | puts | calls.rb:87:5:87:17 | puts |
| calls.rb:144:1:148:3 | S | s_method | calls.rb:145:5:147:7 | s_method |
| calls.rb:144:1:148:3 | S | to_s | calls.rb:151:5:152:7 | to_s |
| calls.rb:150:1:153:3 | A | call_block | calls.rb:67:1:69:3 | call_block |
| calls.rb:150:1:153:3 | A | foo | calls.rb:1:1:3:3 | foo |
| calls.rb:150:1:153:3 | A | foo | calls.rb:71:1:75:3 | foo |
@@ -155,31 +175,41 @@ lookupMethod
| file://:0:0:0:0 | Class | prepend | calls.rb:93:5:93:20 | prepend |
| file://:0:0:0:0 | Class | private | calls.rb:94:5:94:20 | private |
| file://:0:0:0:0 | Class | puts | calls.rb:87:5:87:17 | puts |
| file://:0:0:0:0 | Class | to_s | calls.rb:151:5:152:7 | to_s |
| file://:0:0:0:0 | Complex | new | calls.rb:99:5:99:16 | new |
| file://:0:0:0:0 | Complex | puts | calls.rb:87:5:87:17 | puts |
| file://:0:0:0:0 | Complex | to_s | calls.rb:151:5:152:7 | to_s |
| file://:0:0:0:0 | FalseClass | new | calls.rb:99:5:99:16 | new |
| file://:0:0:0:0 | FalseClass | puts | calls.rb:87:5:87:17 | puts |
| file://:0:0:0:0 | FalseClass | to_s | calls.rb:151:5:152:7 | to_s |
| file://:0:0:0:0 | Float | new | calls.rb:99:5:99:16 | new |
| file://:0:0:0:0 | Float | puts | calls.rb:87:5:87:17 | puts |
| file://:0:0:0:0 | Float | to_s | calls.rb:151:5:152:7 | to_s |
| file://:0:0:0:0 | NilClass | new | calls.rb:99:5:99:16 | new |
| file://:0:0:0:0 | NilClass | puts | calls.rb:87:5:87:17 | puts |
| file://:0:0:0:0 | NilClass | to_s | calls.rb:151:5:152:7 | to_s |
| file://:0:0:0:0 | Numeric | new | calls.rb:99:5:99:16 | new |
| file://:0:0:0:0 | Numeric | puts | calls.rb:87:5:87:17 | puts |
| file://:0:0:0:0 | Numeric | to_s | calls.rb:151:5:152:7 | to_s |
| file://:0:0:0:0 | Rational | new | calls.rb:99:5:99:16 | new |
| file://:0:0:0:0 | Rational | puts | calls.rb:87:5:87:17 | puts |
| file://:0:0:0:0 | Rational | to_s | calls.rb:151:5:152:7 | to_s |
| file://:0:0:0:0 | TrueClass | new | calls.rb:99:5:99:16 | new |
| file://:0:0:0:0 | TrueClass | puts | calls.rb:87:5:87:17 | puts |
| file://:0:0:0:0 | TrueClass | to_s | calls.rb:151:5:152:7 | to_s |
| hello.rb:1:1:8:3 | EnglishWords | hello | hello.rb:2:5:4:7 | hello |
| hello.rb:1:1:8:3 | EnglishWords | world | hello.rb:5:5:7:7 | world |
| hello.rb:11:1:16:3 | Greeting | hello | hello.rb:2:5:4:7 | hello |
| hello.rb:11:1:16:3 | Greeting | message | hello.rb:13:5:15:7 | message |
| hello.rb:11:1:16:3 | Greeting | new | calls.rb:99:5:99:16 | new |
| hello.rb:11:1:16:3 | Greeting | puts | calls.rb:87:5:87:17 | puts |
| hello.rb:11:1:16:3 | Greeting | to_s | calls.rb:151:5:152:7 | to_s |
| hello.rb:11:1:16:3 | Greeting | world | hello.rb:5:5:7:7 | world |
| hello.rb:18:1:22:3 | HelloWorld | hello | hello.rb:2:5:4:7 | hello |
| hello.rb:18:1:22:3 | HelloWorld | message | hello.rb:19:5:21:7 | message |
| hello.rb:18:1:22:3 | HelloWorld | new | calls.rb:99:5:99:16 | new |
| hello.rb:18:1:22:3 | HelloWorld | puts | calls.rb:87:5:87:17 | puts |
| hello.rb:18:1:22:3 | HelloWorld | to_s | calls.rb:151:5:152:7 | to_s |
| hello.rb:18:1:22:3 | HelloWorld | world | hello.rb:5:5:7:7 | world |
| modules.rb:4:1:24:3 | Foo | method_in_another_definition_of_foo | modules.rb:27:3:28:5 | method_in_another_definition_of_foo |
| modules.rb:4:1:24:3 | Foo | method_in_foo | modules.rb:16:3:17:5 | method_in_foo |
@@ -187,37 +217,48 @@ lookupMethod
| modules.rb:5:3:14:5 | Foo::Bar | method_in_foo_bar | modules.rb:9:5:10:7 | method_in_foo_bar |
| modules.rb:6:5:7:7 | Foo::Bar::ClassInFooBar | new | calls.rb:99:5:99:16 | new |
| modules.rb:6:5:7:7 | Foo::Bar::ClassInFooBar | puts | calls.rb:87:5:87:17 | puts |
| modules.rb:6:5:7:7 | Foo::Bar::ClassInFooBar | to_s | calls.rb:151:5:152:7 | to_s |
| modules.rb:19:3:20:5 | Foo::ClassInFoo | new | calls.rb:99:5:99:16 | new |
| modules.rb:19:3:20:5 | Foo::ClassInFoo | puts | calls.rb:87:5:87:17 | puts |
| modules.rb:19:3:20:5 | Foo::ClassInFoo | to_s | calls.rb:151:5:152:7 | to_s |
| modules.rb:30:3:31:5 | Foo::ClassInAnotherDefinitionOfFoo | new | calls.rb:99:5:99:16 | new |
| modules.rb:30:3:31:5 | Foo::ClassInAnotherDefinitionOfFoo | puts | calls.rb:87:5:87:17 | puts |
| modules.rb:30:3:31:5 | Foo::ClassInAnotherDefinitionOfFoo | to_s | calls.rb:151:5:152:7 | to_s |
| modules.rb:37:1:46:3 | Bar | method_a | modules.rb:38:3:39:5 | method_a |
| modules.rb:37:1:46:3 | Bar | method_b | modules.rb:41:3:42:5 | method_b |
| modules.rb:37:1:46:3 | Bar | new | calls.rb:99:5:99:16 | new |
| modules.rb:37:1:46:3 | Bar | puts | calls.rb:87:5:87:17 | puts |
| modules.rb:37:1:46:3 | Bar | to_s | calls.rb:151:5:152:7 | to_s |
| modules.rb:49:3:50:5 | Foo::Bar::ClassInAnotherDefinitionOfFooBar | new | calls.rb:99:5:99:16 | new |
| modules.rb:49:3:50:5 | Foo::Bar::ClassInAnotherDefinitionOfFooBar | puts | calls.rb:87:5:87:17 | puts |
| modules.rb:49:3:50:5 | Foo::Bar::ClassInAnotherDefinitionOfFooBar | to_s | calls.rb:151:5:152:7 | to_s |
| modules.rb:66:5:67:7 | Test::Foo1::Bar | new | calls.rb:99:5:99:16 | new |
| modules.rb:66:5:67:7 | Test::Foo1::Bar | puts | calls.rb:87:5:87:17 | puts |
| modules.rb:66:5:67:7 | Test::Foo1::Bar | to_s | calls.rb:151:5:152:7 | to_s |
| modules.rb:72:5:73:7 | Test::Foo2::Foo2::Bar | new | calls.rb:99:5:99:16 | new |
| modules.rb:72:5:73:7 | Test::Foo2::Foo2::Bar | puts | calls.rb:87:5:87:17 | puts |
| modules.rb:72:5:73:7 | Test::Foo2::Foo2::Bar | to_s | calls.rb:151:5:152:7 | to_s |
| modules.rb:112:1:113:3 | YY | new | calls.rb:99:5:99:16 | new |
| modules.rb:112:1:113:3 | YY | puts | calls.rb:87:5:87:17 | puts |
| modules.rb:112:1:113:3 | YY | to_s | calls.rb:151:5:152:7 | to_s |
| modules.rb:116:7:117:9 | XX::YY | new | calls.rb:99:5:99:16 | new |
| modules.rb:116:7:117:9 | XX::YY | puts | calls.rb:87:5:87:17 | puts |
| private.rb:1:1:19:3 | C | baz | calls.rb:37:5:43:7 | baz |
| private.rb:1:1:19:3 | C | call_block | calls.rb:67:1:69:3 | call_block |
| private.rb:1:1:19:3 | C | foo | calls.rb:1:1:3:3 | foo |
| private.rb:1:1:19:3 | C | foo | calls.rb:71:1:75:3 | foo |
| private.rb:1:1:19:3 | C | funny | calls.rb:119:1:121:3 | funny |
| private.rb:1:1:19:3 | C | indirect | calls.rb:137:1:139:3 | indirect |
| private.rb:1:1:19:3 | C | instance_m | calls.rb:16:5:16:23 | instance_m |
| private.rb:1:1:19:3 | C | new | calls.rb:99:5:99:16 | new |
| private.rb:1:1:19:3 | C | optional_arg | calls.rb:62:1:65:3 | optional_arg |
| private.rb:1:1:19:3 | C | private2 | private.rb:8:3:9:5 | private2 |
| private.rb:1:1:19:3 | C | private3 | private.rb:14:3:15:5 | private3 |
| private.rb:1:1:19:3 | C | private4 | private.rb:17:3:18:5 | private4 |
| private.rb:1:1:19:3 | C | private_on_main | calls.rb:164:1:165:3 | private_on_main |
| private.rb:1:1:19:3 | C | private_on_main | private.rb:21:1:22:3 | private_on_main |
| private.rb:1:1:19:3 | C | public | private.rb:5:3:6:5 | public |
| private.rb:1:1:19:3 | C | puts | calls.rb:87:5:87:17 | puts |
| modules.rb:116:7:117:9 | XX::YY | to_s | calls.rb:151:5:152:7 | to_s |
| modules_rec.rb:1:1:2:3 | B::A | new | calls.rb:99:5:99:16 | new |
| modules_rec.rb:1:1:2:3 | B::A | puts | calls.rb:87:5:87:17 | puts |
| modules_rec.rb:1:1:2:3 | B::A | to_s | calls.rb:151:5:152:7 | to_s |
| modules_rec.rb:4:1:5:3 | A::B | new | calls.rb:99:5:99:16 | new |
| modules_rec.rb:4:1:5:3 | A::B | puts | calls.rb:87:5:87:17 | puts |
| modules_rec.rb:4:1:5:3 | A::B | to_s | calls.rb:151:5:152:7 | to_s |
| private.rb:1:1:29:3 | E | new | calls.rb:99:5:99:16 | new |
| private.rb:1:1:29:3 | E | private2 | private.rb:8:3:9:5 | private2 |
| private.rb:1:1:29:3 | E | private3 | private.rb:14:3:15:5 | private3 |
| private.rb:1:1:29:3 | E | private4 | private.rb:17:3:18:5 | private4 |
| private.rb:1:1:29:3 | E | private_on_main | private.rb:31:1:32:3 | private_on_main |
| private.rb:1:1:29:3 | E | public | private.rb:5:3:6:5 | public |
| private.rb:1:1:29:3 | E | puts | calls.rb:87:5:87:17 | puts |
| private.rb:1:1:29:3 | E | to_s | calls.rb:151:5:152:7 | to_s |
| private.rb:42:1:60:3 | F | private2 | private.rb:49:3:50:5 | private2 |
| private.rb:42:1:60:3 | F | private3 | private.rb:55:3:56:5 | private3 |
| private.rb:42:1:60:3 | F | private4 | private.rb:58:3:59:5 | private4 |
| private.rb:42:1:60:3 | F | public | private.rb:46:3:47:5 | public |

View File

@@ -1,5 +1,6 @@
getModule
| calls.rb:15:1:24:3 | M |
| calls.rb:29:1:44:3 | C |
| calls.rb:51:1:55:3 | D |
| calls.rb:77:1:80:3 | Integer |
| calls.rb:82:1:84:3 | String |
@@ -55,9 +56,13 @@ getModule
| modules.rb:115:1:118:3 | XX |
| modules.rb:116:7:117:9 | XX::YY |
| modules.rb:120:1:121:3 | Test::Foo1::Bar::Baz |
| private.rb:1:1:19:3 | C |
| modules_rec.rb:1:1:2:3 | B::A |
| modules_rec.rb:4:1:5:3 | A::B |
| private.rb:1:1:29:3 | E |
| private.rb:42:1:60:3 | F |
getADeclaration
| calls.rb:15:1:24:3 | M | calls.rb:15:1:24:3 | M |
| calls.rb:29:1:44:3 | C | calls.rb:29:1:44:3 | C |
| calls.rb:51:1:55:3 | D | calls.rb:51:1:55:3 | D |
| calls.rb:77:1:80:3 | Integer | calls.rb:77:1:80:3 | Integer |
| calls.rb:82:1:84:3 | String | calls.rb:82:1:84:3 | String |
@@ -66,12 +71,14 @@ getADeclaration
| calls.rb:97:1:100:3 | Object | calls.rb:1:1:167:16 | calls.rb |
| calls.rb:97:1:100:3 | Object | calls.rb:97:1:100:3 | Object |
| calls.rb:97:1:100:3 | Object | hello.rb:1:1:22:3 | hello.rb |
| calls.rb:97:1:100:3 | Object | modules.rb:1:1:122:1 | modules.rb |
| calls.rb:97:1:100:3 | Object | private.rb:1:1:30:15 | private.rb |
| calls.rb:97:1:100:3 | Object | modules.rb:1:1:121:4 | modules.rb |
| calls.rb:97:1:100:3 | Object | modules_rec.rb:1:1:11:10 | modules_rec.rb |
| calls.rb:97:1:100:3 | Object | private.rb:1:1:60:3 | private.rb |
| calls.rb:102:1:104:3 | Hash | calls.rb:102:1:104:3 | Hash |
| calls.rb:106:1:117:3 | Array | calls.rb:106:1:117:3 | Array |
| calls.rb:144:1:148:3 | S | calls.rb:144:1:148:3 | S |
| calls.rb:150:1:153:3 | A | calls.rb:150:1:153:3 | A |
| calls.rb:150:1:153:3 | A | modules_rec.rb:7:1:9:3 | A |
| calls.rb:155:1:158:3 | B | calls.rb:155:1:158:3 | B |
| hello.rb:1:1:8:3 | EnglishWords | hello.rb:1:1:8:3 | EnglishWords |
| hello.rb:11:1:16:3 | Greeting | hello.rb:11:1:16:3 | Greeting |
@@ -109,10 +116,13 @@ getADeclaration
| modules.rb:115:1:118:3 | XX | modules.rb:115:1:118:3 | XX |
| modules.rb:116:7:117:9 | XX::YY | modules.rb:116:7:117:9 | YY |
| modules.rb:120:1:121:3 | Test::Foo1::Bar::Baz | modules.rb:120:1:121:3 | Baz |
| private.rb:1:1:19:3 | C | calls.rb:29:1:44:3 | C |
| private.rb:1:1:19:3 | C | private.rb:1:1:19:3 | C |
| modules_rec.rb:1:1:2:3 | B::A | modules_rec.rb:1:1:2:3 | A |
| modules_rec.rb:4:1:5:3 | A::B | modules_rec.rb:4:1:5:3 | B |
| private.rb:1:1:29:3 | E | private.rb:1:1:29:3 | E |
| private.rb:42:1:60:3 | F | private.rb:42:1:60:3 | F |
getSuperClass
| calls.rb:51:1:55:3 | D | private.rb:1:1:19:3 | C |
| calls.rb:29:1:44:3 | C | calls.rb:97:1:100:3 | Object |
| calls.rb:51:1:55:3 | D | calls.rb:29:1:44:3 | C |
| calls.rb:77:1:80:3 | Integer | file://:0:0:0:0 | Numeric |
| calls.rb:82:1:84:3 | String | calls.rb:97:1:100:3 | Object |
| calls.rb:90:1:95:3 | Module | calls.rb:97:1:100:3 | Object |
@@ -121,6 +131,7 @@ getSuperClass
| calls.rb:106:1:117:3 | Array | calls.rb:97:1:100:3 | Object |
| calls.rb:144:1:148:3 | S | calls.rb:97:1:100:3 | Object |
| calls.rb:150:1:153:3 | A | calls.rb:144:1:148:3 | S |
| calls.rb:150:1:153:3 | A | calls.rb:155:1:158:3 | B |
| calls.rb:155:1:158:3 | B | calls.rb:144:1:148:3 | S |
| file://:0:0:0:0 | Class | calls.rb:90:1:95:3 | Module |
| file://:0:0:0:0 | Complex | file://:0:0:0:0 | Numeric |
@@ -141,12 +152,130 @@ getSuperClass
| modules.rb:72:5:73:7 | Test::Foo2::Foo2::Bar | calls.rb:97:1:100:3 | Object |
| modules.rb:112:1:113:3 | YY | calls.rb:97:1:100:3 | Object |
| modules.rb:116:7:117:9 | XX::YY | modules.rb:112:1:113:3 | YY |
| private.rb:1:1:19:3 | C | calls.rb:97:1:100:3 | Object |
| modules_rec.rb:1:1:2:3 | B::A | calls.rb:97:1:100:3 | Object |
| modules_rec.rb:4:1:5:3 | A::B | calls.rb:97:1:100:3 | Object |
| private.rb:1:1:29:3 | E | calls.rb:97:1:100:3 | Object |
getAPrependedModule
| calls.rb:97:1:100:3 | Object | calls.rb:150:1:153:3 | A |
| calls.rb:150:1:153:3 | A | modules_rec.rb:4:1:5:3 | A::B |
| modules.rb:101:1:105:3 | PrependTest | modules.rb:63:1:81:3 | Test |
getAnIncludedModule
| calls.rb:29:1:44:3 | C | calls.rb:15:1:24:3 | M |
| calls.rb:97:1:100:3 | Object | calls.rb:86:1:88:3 | Kernel |
| hello.rb:11:1:16:3 | Greeting | hello.rb:1:1:8:3 | EnglishWords |
| modules.rb:88:1:93:3 | IncludeTest | modules.rb:63:1:81:3 | Test |
| modules.rb:95:1:99:3 | IncludeTest2 | modules.rb:63:1:81:3 | Test |
| private.rb:1:1:19:3 | C | calls.rb:15:1:24:3 | M |
resolveConstantReadAccess
| calls.rb:26:1:26:1 | M | M |
| calls.rb:27:1:27:1 | M | M |
| calls.rb:30:13:30:13 | M | M |
| calls.rb:46:5:46:5 | C | C |
| calls.rb:51:11:51:11 | C | C |
| calls.rb:57:5:57:5 | D | D |
| calls.rb:72:11:72:14 | Hash | Hash |
| calls.rb:97:16:97:21 | Module | Module |
| calls.rb:98:13:98:18 | Kernel | Kernel |
| calls.rb:129:1:129:13 | Array | Array |
| calls.rb:131:1:131:7 | Array | Array |
| calls.rb:133:1:133:7 | Array | Array |
| calls.rb:135:1:135:8 | Array | Array |
| calls.rb:150:11:150:11 | S | S |
| calls.rb:155:11:155:11 | S | S |
| calls.rb:160:1:160:1 | S | S |
| calls.rb:161:1:161:1 | A | A |
| calls.rb:162:1:162:1 | B | B |
| hello.rb:12:13:12:24 | EnglishWords | EnglishWords |
| hello.rb:18:20:18:27 | Greeting | Greeting |
| modules.rb:48:8:48:10 | Foo | Foo |
| modules.rb:66:11:66:14 | Foo1 | Test::Foo1 |
| modules.rb:72:11:72:14 | Foo2 | Test::Foo2::Foo2 |
| modules.rb:77:12:77:17 | Object | Object |
| modules.rb:78:11:78:14 | Foo3 | Object |
| modules.rb:89:11:89:16 | Test | Test |
| modules.rb:90:3:90:8 | Object | Object |
| modules.rb:90:32:90:36 | Other | Other |
| modules.rb:91:10:91:13 | Foo1 | Test::Foo1 |
| modules.rb:96:11:96:14 | Test | Test |
| modules.rb:97:10:97:13 | Foo1 | Test::Foo1 |
| modules.rb:102:11:102:16 | Test | Test |
| modules.rb:103:10:103:13 | Foo2 | Test::Foo2 |
| modules.rb:108:10:108:11 | MM | MM |
| modules.rb:116:18:116:19 | YY | YY |
| modules.rb:120:8:120:11 | Test | Test |
| modules.rb:120:8:120:17 | Foo1 | Test::Foo1 |
| modules.rb:120:8:120:22 | Bar | Test::Foo1::Bar |
| modules_rec.rb:1:7:1:7 | B | B |
| modules_rec.rb:4:7:4:7 | A | A |
| modules_rec.rb:7:11:7:11 | B | B |
| modules_rec.rb:8:11:8:11 | B | A::B |
| modules_rec.rb:11:9:11:9 | A | A |
| private.rb:34:1:34:1 | E | E |
| private.rb:35:1:35:1 | E | E |
| private.rb:36:1:36:1 | E | E |
| private.rb:37:1:37:1 | E | E |
| private.rb:38:1:38:1 | E | E |
resolveConstantWriteAccess
| calls.rb:15:1:24:3 | M | M |
| calls.rb:29:1:44:3 | C | C |
| calls.rb:51:1:55:3 | D | D |
| calls.rb:77:1:80:3 | Integer | Integer |
| calls.rb:82:1:84:3 | String | String |
| calls.rb:86:1:88:3 | Kernel | Kernel |
| calls.rb:90:1:95:3 | Module | Module |
| calls.rb:97:1:100:3 | Object | Object |
| calls.rb:102:1:104:3 | Hash | Hash |
| calls.rb:106:1:117:3 | Array | Array |
| calls.rb:144:1:148:3 | S | S |
| calls.rb:150:1:153:3 | A | A |
| calls.rb:155:1:158:3 | B | B |
| hello.rb:1:1:8:3 | EnglishWords | EnglishWords |
| hello.rb:11:1:16:3 | Greeting | Greeting |
| hello.rb:18:1:22:3 | HelloWorld | HelloWorld |
| modules.rb:1:1:2:3 | Empty | Empty |
| modules.rb:4:1:24:3 | Foo | Foo |
| modules.rb:5:3:14:5 | Bar | Foo::Bar |
| modules.rb:6:5:7:7 | ClassInFooBar | Foo::Bar::ClassInFooBar |
| modules.rb:19:3:20:5 | ClassInFoo | Foo::ClassInFoo |
| modules.rb:26:1:35:3 | Foo | Foo |
| modules.rb:30:3:31:5 | ClassInAnotherDefinitionOfFoo | Foo::ClassInAnotherDefinitionOfFoo |
| modules.rb:37:1:46:3 | Bar | Bar |
| modules.rb:48:1:57:3 | Bar | Foo::Bar |
| modules.rb:49:3:50:5 | ClassInAnotherDefinitionOfFooBar | Foo::Bar::ClassInAnotherDefinitionOfFooBar |
| modules.rb:60:1:61:3 | MyModuleInGlobalScope | MyModuleInGlobalScope |
| modules.rb:63:1:81:3 | Test | Test |
| modules.rb:65:3:68:5 | Foo1 | Test::Foo1 |
| modules.rb:66:5:67:7 | Bar | Foo1::Bar |
| modules.rb:66:5:67:7 | Bar | Test::Foo1::Bar |
| modules.rb:70:3:74:5 | Foo2 | Test::Foo2 |
| modules.rb:71:5:71:19 | Foo2 | Test::Foo2::Foo2 |
| modules.rb:72:5:73:7 | Bar | Foo2::Bar |
| modules.rb:72:5:73:7 | Bar | Test::Foo2::Bar |
| modules.rb:72:5:73:7 | Bar | Test::Foo2::Foo2::Bar |
| modules.rb:76:3:80:5 | Foo3 | Test::Foo3 |
| modules.rb:77:5:77:8 | Foo3 | Test::Foo3::Foo3 |
| modules.rb:78:5:79:7 | Bar | Foo3::Bar |
| modules.rb:78:5:79:7 | Bar | Test::Foo3::Bar |
| modules.rb:78:5:79:7 | Bar | Test::Foo3::Foo3::Bar |
| modules.rb:83:1:86:3 | Other | Other |
| modules.rb:84:3:85:5 | Foo1 | Other::Foo1 |
| modules.rb:88:1:93:3 | IncludeTest | IncludeTest |
| modules.rb:91:3:92:5 | Y | Foo1::Y |
| modules.rb:91:3:92:5 | Y | Test::Foo1::Y |
| modules.rb:95:1:99:3 | IncludeTest2 | IncludeTest2 |
| modules.rb:97:3:98:5 | Z | Foo1::Z |
| modules.rb:97:3:98:5 | Z | Test::Foo1::Z |
| modules.rb:101:1:105:3 | PrependTest | PrependTest |
| modules.rb:103:3:104:5 | Y | Foo2::Y |
| modules.rb:103:3:104:5 | Y | Test::Foo2::Y |
| modules.rb:107:1:110:3 | MM | MM |
| modules.rb:108:3:109:5 | MM | MM::MM |
| modules.rb:108:3:109:5 | MM | MM::MM::MM |
| modules.rb:112:1:113:3 | YY | YY |
| modules.rb:115:1:118:3 | XX | XX |
| modules.rb:116:7:117:9 | YY | XX::YY |
| modules.rb:120:1:121:3 | Baz | Test::Foo1::Bar::Baz |
| modules_rec.rb:1:1:2:3 | A | B::A |
| modules_rec.rb:4:1:5:3 | B | A::B |
| modules_rec.rb:7:1:9:3 | A | A |
| private.rb:1:1:29:3 | E | E |
| private.rb:42:1:60:3 | F | F |

View File

@@ -1,4 +1,5 @@
import ruby
private import codeql.ruby.ast.internal.Module as Internal
query Module getModule() { any() }
@@ -9,3 +10,11 @@ query Module getSuperClass(Module m) { result = m.getSuperClass() }
query Module getAPrependedModule(Module m) { result = m.getAPrependedModule() }
query Module getAnIncludedModule(Module m) { result = m.getAnIncludedModule() }
query predicate resolveConstantReadAccess(ConstantReadAccess a, string s) {
Internal::TResolved(s) = Internal::resolveConstantReadAccess(a)
}
query predicate resolveConstantWriteAccess(ConstantWriteAccess c, string s) {
s = Internal::resolveConstantWriteAccess(c)
}

View File

@@ -119,4 +119,3 @@ end
module Test::Foo1::Bar::Baz
end

View File

@@ -0,0 +1,11 @@
class B::A
end
class A::B
end
class A < B
prepend B
end
prepend A

View File

@@ -1,4 +1,4 @@
class C
class E
private def private1
end
@@ -16,15 +16,45 @@ class C
def private4
end
def self.public2
end
private_class_method def self.private5
end
def self.private6
end
private_class_method :private6
end
def private_on_main
end
C.new.private1
C.new.private2
C.new.private3
C.new.private4
C.new.public
E.new.private1
E.new.private2
E.new.private3
E.new.private4
E.new.public
private_on_main
private_on_main
module F
private def private1
end
def public
end
def private2
end
private :private2
private
def private3
end
def private4
end
end

View File

@@ -48,11 +48,9 @@ calls.rb:
# 15| M
private.rb:
# 1| C
# 29| C
#-----| -> Object
calls.rb:
# 51| D
#-----| -> C
@@ -64,6 +62,7 @@ calls.rb:
# 150| A
#-----| -> S
#-----| -> B
# 155| B
#-----| -> S
@@ -104,6 +103,13 @@ modules.rb:
# 115| XX
private.rb:
# 1| E
#-----| -> Object
# 42| F
modules.rb:
# 5| Foo::Bar
# 19| Foo::ClassInFoo
@@ -128,6 +134,14 @@ modules.rb:
# 71| Test::Foo2::Foo2
modules_rec.rb:
# 1| B::A
#-----| -> Object
# 4| A::B
#-----| -> Object
modules.rb:
# 108| MM::MM
# 49| Foo::Bar::ClassInAnotherDefinitionOfFooBar

View File

@@ -23,6 +23,11 @@ parameterVariable
| parameters.rb:49:12:49:16 | (..., ...) | parameters.rb:49:13:49:13 | a |
| parameters.rb:49:12:49:16 | (..., ...) | parameters.rb:49:15:49:15 | b |
| parameters.rb:54:14:54:14 | y | parameters.rb:54:14:54:14 | y |
| parameters.rb:59:19:59:27 | (..., ...) | parameters.rb:59:20:59:20 | a |
| parameters.rb:59:19:59:27 | (..., ...) | parameters.rb:59:23:59:23 | b |
| parameters.rb:59:19:59:27 | (..., ...) | parameters.rb:59:25:59:25 | c |
| parameters.rb:59:22:59:26 | (..., ...) | parameters.rb:59:23:59:23 | b |
| parameters.rb:59:22:59:26 | (..., ...) | parameters.rb:59:25:59:25 | c |
| scopes.rb:2:14:2:14 | x | scopes.rb:2:14:2:14 | x |
| scopes.rb:9:14:9:14 | x | scopes.rb:9:14:9:14 | x |
| ssa.rb:1:7:1:7 | b | ssa.rb:1:7:1:7 | b |

View File

@@ -56,3 +56,7 @@ x = 10
puts y
end
def tuples_nested((a,(b,c)))
puts "#{a} #{b} #{c}"
end

View File

@@ -29,7 +29,7 @@ definition
| nested_scopes.rb:30:16:30:19 | self (class << ...) | nested_scopes.rb:30:7:33:9 | self |
| nested_scopes.rb:31:11:31:16 | ... = ... | nested_scopes.rb:31:11:31:11 | a |
| nested_scopes.rb:40:1:40:18 | ... = ... | nested_scopes.rb:40:1:40:1 | d |
| parameters.rb:1:9:5:3 | <captured> | parameters.rb:1:1:58:1 | self |
| parameters.rb:1:9:5:3 | <captured> | parameters.rb:1:1:62:1 | self |
| parameters.rb:1:14:1:14 | x | parameters.rb:1:14:1:14 | x |
| parameters.rb:2:4:2:8 | ... = ... | parameters.rb:1:18:1:18 | y |
| parameters.rb:7:1:13:3 | self (order_pizza) | parameters.rb:7:1:13:3 | self |
@@ -63,11 +63,15 @@ definition
| parameters.rb:49:13:49:13 | a | parameters.rb:49:13:49:13 | a |
| parameters.rb:49:15:49:15 | b | parameters.rb:49:15:49:15 | b |
| parameters.rb:53:1:53:6 | ... = ... | parameters.rb:53:1:53:1 | x |
| parameters.rb:54:9:57:3 | <captured> | parameters.rb:1:1:58:1 | self |
| parameters.rb:54:9:57:3 | <captured> | parameters.rb:1:1:62:1 | self |
| parameters.rb:54:9:57:3 | <captured> | parameters.rb:53:1:53:1 | x |
| parameters.rb:54:14:54:14 | y | parameters.rb:54:14:54:14 | y |
| parameters.rb:54:19:54:23 | ... = ... | parameters.rb:53:1:53:1 | x |
| parameters.rb:55:4:55:9 | phi | parameters.rb:53:1:53:1 | x |
| parameters.rb:59:1:61:3 | self (tuples_nested) | parameters.rb:59:1:61:3 | self |
| parameters.rb:59:20:59:20 | a | parameters.rb:59:20:59:20 | a |
| parameters.rb:59:23:59:23 | b | parameters.rb:59:23:59:23 | b |
| parameters.rb:59:25:59:25 | c | parameters.rb:59:25:59:25 | c |
| scopes.rb:1:1:1:15 | self (scopes.rb) | scopes.rb:1:1:49:4 | self |
| scopes.rb:2:9:6:3 | <captured> | scopes.rb:1:1:49:4 | self |
| scopes.rb:4:4:4:8 | ... = ... | scopes.rb:4:4:4:4 | a |
@@ -180,8 +184,8 @@ read
| nested_scopes.rb:30:16:30:19 | self (class << ...) | nested_scopes.rb:30:7:33:9 | self | nested_scopes.rb:32:11:32:16 | self |
| nested_scopes.rb:31:11:31:16 | ... = ... | nested_scopes.rb:31:11:31:11 | a | nested_scopes.rb:32:16:32:16 | a |
| nested_scopes.rb:40:1:40:18 | ... = ... | nested_scopes.rb:40:1:40:1 | d | nested_scopes.rb:41:1:41:1 | d |
| parameters.rb:1:9:5:3 | <captured> | parameters.rb:1:1:58:1 | self | parameters.rb:3:4:3:9 | self |
| parameters.rb:1:9:5:3 | <captured> | parameters.rb:1:1:58:1 | self | parameters.rb:4:4:4:9 | self |
| parameters.rb:1:9:5:3 | <captured> | parameters.rb:1:1:62:1 | self | parameters.rb:3:4:3:9 | self |
| parameters.rb:1:9:5:3 | <captured> | parameters.rb:1:1:62:1 | self | parameters.rb:4:4:4:9 | self |
| parameters.rb:1:14:1:14 | x | parameters.rb:1:14:1:14 | x | parameters.rb:3:9:3:9 | x |
| parameters.rb:2:4:2:8 | ... = ... | parameters.rb:1:18:1:18 | y | parameters.rb:4:9:4:9 | y |
| parameters.rb:7:1:13:3 | self (order_pizza) | parameters.rb:7:1:13:3 | self | parameters.rb:9:5:9:33 | self |
@@ -215,10 +219,14 @@ read
| parameters.rb:49:1:51:3 | self (tuples) | parameters.rb:49:1:51:3 | self | parameters.rb:50:3:50:18 | self |
| parameters.rb:49:13:49:13 | a | parameters.rb:49:13:49:13 | a | parameters.rb:50:11:50:11 | a |
| parameters.rb:49:15:49:15 | b | parameters.rb:49:15:49:15 | b | parameters.rb:50:16:50:16 | b |
| parameters.rb:54:9:57:3 | <captured> | parameters.rb:1:1:58:1 | self | parameters.rb:55:4:55:9 | self |
| parameters.rb:54:9:57:3 | <captured> | parameters.rb:1:1:58:1 | self | parameters.rb:56:4:56:9 | self |
| parameters.rb:54:9:57:3 | <captured> | parameters.rb:1:1:62:1 | self | parameters.rb:55:4:55:9 | self |
| parameters.rb:54:9:57:3 | <captured> | parameters.rb:1:1:62:1 | self | parameters.rb:56:4:56:9 | self |
| parameters.rb:54:14:54:14 | y | parameters.rb:54:14:54:14 | y | parameters.rb:56:9:56:9 | y |
| parameters.rb:55:4:55:9 | phi | parameters.rb:53:1:53:1 | x | parameters.rb:55:9:55:9 | x |
| parameters.rb:59:1:61:3 | self (tuples_nested) | parameters.rb:59:1:61:3 | self | parameters.rb:60:3:60:23 | self |
| parameters.rb:59:20:59:20 | a | parameters.rb:59:20:59:20 | a | parameters.rb:60:11:60:11 | a |
| parameters.rb:59:23:59:23 | b | parameters.rb:59:23:59:23 | b | parameters.rb:60:16:60:16 | b |
| parameters.rb:59:25:59:25 | c | parameters.rb:59:25:59:25 | c | parameters.rb:60:21:60:21 | c |
| scopes.rb:1:1:1:15 | self (scopes.rb) | scopes.rb:1:1:49:4 | self | scopes.rb:8:1:8:6 | self |
| scopes.rb:2:9:6:3 | <captured> | scopes.rb:1:1:49:4 | self | scopes.rb:3:4:3:9 | self |
| scopes.rb:2:9:6:3 | <captured> | scopes.rb:1:1:49:4 | self | scopes.rb:3:9:3:9 | self |
@@ -339,7 +347,7 @@ firstRead
| nested_scopes.rb:30:16:30:19 | self (class << ...) | nested_scopes.rb:30:7:33:9 | self | nested_scopes.rb:32:11:32:16 | self |
| nested_scopes.rb:31:11:31:16 | ... = ... | nested_scopes.rb:31:11:31:11 | a | nested_scopes.rb:32:16:32:16 | a |
| nested_scopes.rb:40:1:40:18 | ... = ... | nested_scopes.rb:40:1:40:1 | d | nested_scopes.rb:41:1:41:1 | d |
| parameters.rb:1:9:5:3 | <captured> | parameters.rb:1:1:58:1 | self | parameters.rb:3:4:3:9 | self |
| parameters.rb:1:9:5:3 | <captured> | parameters.rb:1:1:62:1 | self | parameters.rb:3:4:3:9 | self |
| parameters.rb:1:14:1:14 | x | parameters.rb:1:14:1:14 | x | parameters.rb:3:9:3:9 | x |
| parameters.rb:2:4:2:8 | ... = ... | parameters.rb:1:18:1:18 | y | parameters.rb:4:9:4:9 | y |
| parameters.rb:7:1:13:3 | self (order_pizza) | parameters.rb:7:1:13:3 | self | parameters.rb:9:5:9:33 | self |
@@ -371,9 +379,13 @@ firstRead
| parameters.rb:49:1:51:3 | self (tuples) | parameters.rb:49:1:51:3 | self | parameters.rb:50:3:50:18 | self |
| parameters.rb:49:13:49:13 | a | parameters.rb:49:13:49:13 | a | parameters.rb:50:11:50:11 | a |
| parameters.rb:49:15:49:15 | b | parameters.rb:49:15:49:15 | b | parameters.rb:50:16:50:16 | b |
| parameters.rb:54:9:57:3 | <captured> | parameters.rb:1:1:58:1 | self | parameters.rb:55:4:55:9 | self |
| parameters.rb:54:9:57:3 | <captured> | parameters.rb:1:1:62:1 | self | parameters.rb:55:4:55:9 | self |
| parameters.rb:54:14:54:14 | y | parameters.rb:54:14:54:14 | y | parameters.rb:56:9:56:9 | y |
| parameters.rb:55:4:55:9 | phi | parameters.rb:53:1:53:1 | x | parameters.rb:55:9:55:9 | x |
| parameters.rb:59:1:61:3 | self (tuples_nested) | parameters.rb:59:1:61:3 | self | parameters.rb:60:3:60:23 | self |
| parameters.rb:59:20:59:20 | a | parameters.rb:59:20:59:20 | a | parameters.rb:60:11:60:11 | a |
| parameters.rb:59:23:59:23 | b | parameters.rb:59:23:59:23 | b | parameters.rb:60:16:60:16 | b |
| parameters.rb:59:25:59:25 | c | parameters.rb:59:25:59:25 | c | parameters.rb:60:21:60:21 | c |
| scopes.rb:1:1:1:15 | self (scopes.rb) | scopes.rb:1:1:49:4 | self | scopes.rb:8:1:8:6 | self |
| scopes.rb:2:9:6:3 | <captured> | scopes.rb:1:1:49:4 | self | scopes.rb:3:4:3:9 | self |
| scopes.rb:4:4:4:8 | ... = ... | scopes.rb:4:4:4:4 | a | scopes.rb:5:9:5:9 | a |
@@ -464,7 +476,7 @@ lastRead
| nested_scopes.rb:30:16:30:19 | self (class << ...) | nested_scopes.rb:30:7:33:9 | self | nested_scopes.rb:32:11:32:16 | self |
| nested_scopes.rb:31:11:31:16 | ... = ... | nested_scopes.rb:31:11:31:11 | a | nested_scopes.rb:32:16:32:16 | a |
| nested_scopes.rb:40:1:40:18 | ... = ... | nested_scopes.rb:40:1:40:1 | d | nested_scopes.rb:41:1:41:1 | d |
| parameters.rb:1:9:5:3 | <captured> | parameters.rb:1:1:58:1 | self | parameters.rb:4:4:4:9 | self |
| parameters.rb:1:9:5:3 | <captured> | parameters.rb:1:1:62:1 | self | parameters.rb:4:4:4:9 | self |
| parameters.rb:1:14:1:14 | x | parameters.rb:1:14:1:14 | x | parameters.rb:3:9:3:9 | x |
| parameters.rb:2:4:2:8 | ... = ... | parameters.rb:1:18:1:18 | y | parameters.rb:4:9:4:9 | y |
| parameters.rb:7:1:13:3 | self (order_pizza) | parameters.rb:7:1:13:3 | self | parameters.rb:9:5:9:33 | self |
@@ -496,9 +508,13 @@ lastRead
| parameters.rb:49:1:51:3 | self (tuples) | parameters.rb:49:1:51:3 | self | parameters.rb:50:3:50:18 | self |
| parameters.rb:49:13:49:13 | a | parameters.rb:49:13:49:13 | a | parameters.rb:50:11:50:11 | a |
| parameters.rb:49:15:49:15 | b | parameters.rb:49:15:49:15 | b | parameters.rb:50:16:50:16 | b |
| parameters.rb:54:9:57:3 | <captured> | parameters.rb:1:1:58:1 | self | parameters.rb:56:4:56:9 | self |
| parameters.rb:54:9:57:3 | <captured> | parameters.rb:1:1:62:1 | self | parameters.rb:56:4:56:9 | self |
| parameters.rb:54:14:54:14 | y | parameters.rb:54:14:54:14 | y | parameters.rb:56:9:56:9 | y |
| parameters.rb:55:4:55:9 | phi | parameters.rb:53:1:53:1 | x | parameters.rb:55:9:55:9 | x |
| parameters.rb:59:1:61:3 | self (tuples_nested) | parameters.rb:59:1:61:3 | self | parameters.rb:60:3:60:23 | self |
| parameters.rb:59:20:59:20 | a | parameters.rb:59:20:59:20 | a | parameters.rb:60:11:60:11 | a |
| parameters.rb:59:23:59:23 | b | parameters.rb:59:23:59:23 | b | parameters.rb:60:16:60:16 | b |
| parameters.rb:59:25:59:25 | c | parameters.rb:59:25:59:25 | c | parameters.rb:60:21:60:21 | c |
| scopes.rb:1:1:1:15 | self (scopes.rb) | scopes.rb:1:1:49:4 | self | scopes.rb:8:1:8:6 | self |
| scopes.rb:2:9:6:3 | <captured> | scopes.rb:1:1:49:4 | self | scopes.rb:5:4:5:9 | self |
| scopes.rb:4:4:4:8 | ... = ... | scopes.rb:4:4:4:4 | a | scopes.rb:5:9:5:9 | a |
@@ -568,11 +584,11 @@ adjacentReads
| nested_scopes.rb:13:11:13:15 | ... = ... | nested_scopes.rb:13:11:13:11 | a | nested_scopes.rb:14:16:14:16 | a | nested_scopes.rb:15:11:15:11 | a |
| nested_scopes.rb:27:7:29:9 | self (show) | nested_scopes.rb:27:7:29:9 | self | nested_scopes.rb:28:11:28:16 | self | nested_scopes.rb:28:16:28:16 | self |
| nested_scopes.rb:30:16:30:19 | self (class << ...) | nested_scopes.rb:30:7:33:9 | self | nested_scopes.rb:30:16:30:19 | self | nested_scopes.rb:32:11:32:16 | self |
| parameters.rb:1:9:5:3 | <captured> | parameters.rb:1:1:58:1 | self | parameters.rb:3:4:3:9 | self | parameters.rb:4:4:4:9 | self |
| parameters.rb:1:9:5:3 | <captured> | parameters.rb:1:1:62:1 | self | parameters.rb:3:4:3:9 | self | parameters.rb:4:4:4:9 | self |
| parameters.rb:7:26:7:31 | pizzas | parameters.rb:7:26:7:31 | pizzas | parameters.rb:8:6:8:11 | pizzas | parameters.rb:11:14:11:19 | pizzas |
| parameters.rb:25:1:28:3 | self (opt_param) | parameters.rb:25:1:28:3 | self | parameters.rb:26:3:26:11 | self | parameters.rb:27:3:27:11 | self |
| parameters.rb:25:15:25:18 | name | parameters.rb:25:15:25:18 | name | parameters.rb:25:40:25:43 | name | parameters.rb:26:8:26:11 | name |
| parameters.rb:54:9:57:3 | <captured> | parameters.rb:1:1:58:1 | self | parameters.rb:55:4:55:9 | self | parameters.rb:56:4:56:9 | self |
| parameters.rb:54:9:57:3 | <captured> | parameters.rb:1:1:62:1 | self | parameters.rb:55:4:55:9 | self | parameters.rb:56:4:56:9 | self |
| scopes.rb:2:9:6:3 | <captured> | scopes.rb:1:1:49:4 | self | scopes.rb:3:4:3:9 | self | scopes.rb:3:9:3:9 | self |
| scopes.rb:2:9:6:3 | <captured> | scopes.rb:1:1:49:4 | self | scopes.rb:3:9:3:9 | self | scopes.rb:5:4:5:9 | self |
| scopes.rb:9:9:18:3 | <captured> | scopes.rb:1:1:49:4 | self | scopes.rb:10:4:10:9 | self | scopes.rb:12:4:12:9 | self |

View File

@@ -73,9 +73,9 @@ variableAccess
| parameters.rb:1:14:1:14 | x | parameters.rb:1:14:1:14 | x | parameters.rb:1:9:5:3 | do ... end |
| parameters.rb:1:18:1:18 | y | parameters.rb:1:18:1:18 | y | parameters.rb:1:9:5:3 | do ... end |
| parameters.rb:2:4:2:4 | y | parameters.rb:1:18:1:18 | y | parameters.rb:1:9:5:3 | do ... end |
| parameters.rb:3:4:3:9 | self | parameters.rb:1:1:58:1 | self | parameters.rb:1:1:58:1 | parameters.rb |
| parameters.rb:3:4:3:9 | self | parameters.rb:1:1:62:1 | self | parameters.rb:1:1:62:1 | parameters.rb |
| parameters.rb:3:9:3:9 | x | parameters.rb:1:14:1:14 | x | parameters.rb:1:9:5:3 | do ... end |
| parameters.rb:4:4:4:9 | self | parameters.rb:1:1:58:1 | self | parameters.rb:1:1:58:1 | parameters.rb |
| parameters.rb:4:4:4:9 | self | parameters.rb:1:1:62:1 | self | parameters.rb:1:1:62:1 | parameters.rb |
| parameters.rb:4:9:4:9 | y | parameters.rb:1:18:1:18 | y | parameters.rb:1:9:5:3 | do ... end |
| parameters.rb:7:17:7:22 | client | parameters.rb:7:17:7:22 | client | parameters.rb:7:1:13:3 | order_pizza |
| parameters.rb:7:26:7:31 | pizzas | parameters.rb:7:26:7:31 | pizzas | parameters.rb:7:1:13:3 | order_pizza |
@@ -108,7 +108,7 @@ variableAccess
| parameters.rb:31:11:31:15 | first | parameters.rb:30:15:30:19 | first | parameters.rb:30:1:32:3 | key_param |
| parameters.rb:31:20:31:25 | middle | parameters.rb:30:24:30:29 | middle | parameters.rb:30:1:32:3 | key_param |
| parameters.rb:31:30:31:33 | last | parameters.rb:30:36:30:39 | last | parameters.rb:30:1:32:3 | key_param |
| parameters.rb:34:1:34:1 | b | parameters.rb:34:1:34:1 | b | parameters.rb:1:1:58:1 | parameters.rb |
| parameters.rb:34:1:34:1 | b | parameters.rb:34:1:34:1 | b | parameters.rb:1:1:62:1 | parameters.rb |
| parameters.rb:35:11:35:11 | a | parameters.rb:35:11:35:11 | a | parameters.rb:35:1:38:3 | multi |
| parameters.rb:35:16:35:16 | b | parameters.rb:35:16:35:16 | b | parameters.rb:35:1:38:3 | multi |
| parameters.rb:37:3:37:18 | self | parameters.rb:35:1:38:3 | self | parameters.rb:35:1:38:3 | multi |
@@ -127,13 +127,20 @@ variableAccess
| parameters.rb:50:3:50:18 | self | parameters.rb:49:1:51:3 | self | parameters.rb:49:1:51:3 | tuples |
| parameters.rb:50:11:50:11 | a | parameters.rb:49:13:49:13 | a | parameters.rb:49:1:51:3 | tuples |
| parameters.rb:50:16:50:16 | b | parameters.rb:49:15:49:15 | b | parameters.rb:49:1:51:3 | tuples |
| parameters.rb:53:1:53:1 | x | parameters.rb:53:1:53:1 | x | parameters.rb:1:1:58:1 | parameters.rb |
| parameters.rb:53:1:53:1 | x | parameters.rb:53:1:53:1 | x | parameters.rb:1:1:62:1 | parameters.rb |
| parameters.rb:54:14:54:14 | y | parameters.rb:54:14:54:14 | y | parameters.rb:54:9:57:3 | do ... end |
| parameters.rb:54:19:54:19 | x | parameters.rb:53:1:53:1 | x | parameters.rb:1:1:58:1 | parameters.rb |
| parameters.rb:55:4:55:9 | self | parameters.rb:1:1:58:1 | self | parameters.rb:1:1:58:1 | parameters.rb |
| parameters.rb:55:9:55:9 | x | parameters.rb:53:1:53:1 | x | parameters.rb:1:1:58:1 | parameters.rb |
| parameters.rb:56:4:56:9 | self | parameters.rb:1:1:58:1 | self | parameters.rb:1:1:58:1 | parameters.rb |
| parameters.rb:54:19:54:19 | x | parameters.rb:53:1:53:1 | x | parameters.rb:1:1:62:1 | parameters.rb |
| parameters.rb:55:4:55:9 | self | parameters.rb:1:1:62:1 | self | parameters.rb:1:1:62:1 | parameters.rb |
| parameters.rb:55:9:55:9 | x | parameters.rb:53:1:53:1 | x | parameters.rb:1:1:62:1 | parameters.rb |
| parameters.rb:56:4:56:9 | self | parameters.rb:1:1:62:1 | self | parameters.rb:1:1:62:1 | parameters.rb |
| parameters.rb:56:9:56:9 | y | parameters.rb:54:14:54:14 | y | parameters.rb:54:9:57:3 | do ... end |
| parameters.rb:59:20:59:20 | a | parameters.rb:59:20:59:20 | a | parameters.rb:59:1:61:3 | tuples_nested |
| parameters.rb:59:23:59:23 | b | parameters.rb:59:23:59:23 | b | parameters.rb:59:1:61:3 | tuples_nested |
| parameters.rb:59:25:59:25 | c | parameters.rb:59:25:59:25 | c | parameters.rb:59:1:61:3 | tuples_nested |
| parameters.rb:60:3:60:23 | self | parameters.rb:59:1:61:3 | self | parameters.rb:59:1:61:3 | tuples_nested |
| parameters.rb:60:11:60:11 | a | parameters.rb:59:20:59:20 | a | parameters.rb:59:1:61:3 | tuples_nested |
| parameters.rb:60:16:60:16 | b | parameters.rb:59:23:59:23 | b | parameters.rb:59:1:61:3 | tuples_nested |
| parameters.rb:60:21:60:21 | c | parameters.rb:59:25:59:25 | c | parameters.rb:59:1:61:3 | tuples_nested |
| scopes.rb:2:14:2:14 | x | scopes.rb:2:14:2:14 | x | scopes.rb:2:9:6:3 | do ... end |
| scopes.rb:3:4:3:9 | self | scopes.rb:1:1:49:4 | self | scopes.rb:1:1:49:4 | scopes.rb |
| scopes.rb:3:9:3:9 | self | scopes.rb:1:1:49:4 | self | scopes.rb:1:1:49:4 | scopes.rb |
@@ -354,6 +361,9 @@ implicitWrite
| parameters.rb:49:13:49:13 | a |
| parameters.rb:49:15:49:15 | b |
| parameters.rb:54:14:54:14 | y |
| parameters.rb:59:20:59:20 | a |
| parameters.rb:59:23:59:23 | b |
| parameters.rb:59:25:59:25 | c |
| scopes.rb:2:14:2:14 | x |
| scopes.rb:9:14:9:14 | x |
| ssa.rb:1:7:1:7 | b |
@@ -452,6 +462,10 @@ readAccess
| parameters.rb:55:9:55:9 | x |
| parameters.rb:56:4:56:9 | self |
| parameters.rb:56:9:56:9 | y |
| parameters.rb:60:3:60:23 | self |
| parameters.rb:60:11:60:11 | a |
| parameters.rb:60:16:60:16 | b |
| parameters.rb:60:21:60:21 | c |
| scopes.rb:3:4:3:9 | self |
| scopes.rb:3:9:3:9 | self |
| scopes.rb:5:4:5:9 | self |

View File

@@ -56,7 +56,7 @@
| nested_scopes.rb:30:7:33:9 | self |
| nested_scopes.rb:31:11:31:11 | a |
| nested_scopes.rb:40:1:40:1 | d |
| parameters.rb:1:1:58:1 | self |
| parameters.rb:1:1:62:1 | self |
| parameters.rb:1:14:1:14 | x |
| parameters.rb:1:18:1:18 | y |
| parameters.rb:7:1:13:3 | self |
@@ -89,6 +89,10 @@
| parameters.rb:49:15:49:15 | b |
| parameters.rb:53:1:53:1 | x |
| parameters.rb:54:14:54:14 | y |
| parameters.rb:59:1:61:3 | self |
| parameters.rb:59:20:59:20 | a |
| parameters.rb:59:23:59:23 | b |
| parameters.rb:59:25:59:25 | c |
| scopes.rb:1:1:1:15 | self |
| scopes.rb:1:1:49:4 | self |
| scopes.rb:2:14:2:14 | x |

View File

@@ -32,7 +32,7 @@
| nested_scopes.rb:22:9:24:11 | show_a2 |
| nested_scopes.rb:27:7:29:9 | show |
| nested_scopes.rb:30:7:33:9 | class << ... |
| parameters.rb:1:1:58:1 | parameters.rb |
| parameters.rb:1:1:62:1 | parameters.rb |
| parameters.rb:1:9:5:3 | do ... end |
| parameters.rb:7:1:13:3 | order_pizza |
| parameters.rb:15:1:19:3 | print_map |
@@ -45,6 +45,7 @@
| parameters.rb:45:1:47:3 | dup_underscore |
| parameters.rb:49:1:51:3 | tuples |
| parameters.rb:54:9:57:3 | do ... end |
| parameters.rb:59:1:61:3 | tuples_nested |
| scopes.rb:1:1:1:15 | a |
| scopes.rb:1:1:49:4 | scopes.rb |
| scopes.rb:2:9:6:3 | do ... end |

View File

@@ -1,5 +1,5 @@
name: codeql/ruby-tests
version: 0.0.2
groups: [ruby, test]
dependencies:
codeql/ruby-queries: ^0.0.2
codeql/ruby-examples: ^0.0.2