mirror of
https://github.com/github/codeql.git
synced 2026-04-30 11:15:13 +02:00
Ruby: non-local variables in variable reference pattern
This commit is contained in:
@@ -418,7 +418,7 @@ class VariableReferencePattern extends CasePattern, TVariableReferencePattern {
|
||||
VariableReferencePattern() { this = TVariableReferencePattern(g) }
|
||||
|
||||
/** Gets the variable access corresponding to this variable reference pattern. */
|
||||
LocalVariableReadAccess getVariableAccess() { toGenerated(result) = g.getName() }
|
||||
VariableReadAccess getVariableAccess() { toGenerated(result) = g.getName() }
|
||||
|
||||
final override string getAPrimaryQlClass() { result = "VariableReferencePattern" }
|
||||
|
||||
|
||||
@@ -1115,6 +1115,21 @@ control/cases.rb:
|
||||
# 144| getClass: [ConstantReadAccess] Bar
|
||||
# 144| getKey: [SymbolLiteral] :a
|
||||
# 144| getValue: [IntegerLiteral] 1
|
||||
# 147| getStmt: [CaseExpr] case ...
|
||||
# 147| getValue: [MethodCall] call to expr
|
||||
# 147| getReceiver: [Self, SelfVariableAccess] self
|
||||
# 148| getBranch: [InClause] in ... then ...
|
||||
# 148| getPattern: [VariableReferencePattern] ^...
|
||||
# 148| getVariableAccess: [LocalVariableAccess] foo
|
||||
# 149| getBranch: [InClause] in ... then ...
|
||||
# 149| getPattern: [VariableReferencePattern] ^...
|
||||
# 149| getVariableAccess: [GlobalVariableAccess] $foo
|
||||
# 150| getBranch: [InClause] in ... then ...
|
||||
# 150| getPattern: [VariableReferencePattern] ^...
|
||||
# 150| getVariableAccess: [InstanceVariableAccess] @foo
|
||||
# 151| getBranch: [InClause] in ... then ...
|
||||
# 151| getPattern: [VariableReferencePattern] ^...
|
||||
# 151| getVariableAccess: [ClassVariableAccess] @@foo
|
||||
modules/classes.rb:
|
||||
# 2| [Toplevel] classes.rb
|
||||
# 3| getStmt: [ClassDeclaration] Foo
|
||||
|
||||
@@ -236,6 +236,7 @@
|
||||
| control/cases.rb:142:11:142:11 | :y | :y |
|
||||
| control/cases.rb:144:11:144:11 | :a | :a |
|
||||
| control/cases.rb:144:14:144:14 | 1 | 1 |
|
||||
| control/cases.rb:148:7:148:9 | foo | 42 |
|
||||
| control/conditionals.rb:2:5:2:5 | 0 | 0 |
|
||||
| control/conditionals.rb:3:5:3:5 | 0 | 0 |
|
||||
| control/conditionals.rb:4:5:4:5 | 0 | 0 |
|
||||
|
||||
@@ -8,6 +8,7 @@ caseValues
|
||||
| cases.rb:116:1:124:3 | case ... | cases.rb:116:6:116:9 | call to expr |
|
||||
| cases.rb:128:1:133:3 | case ... | cases.rb:128:6:128:9 | call to expr |
|
||||
| cases.rb:137:1:145:3 | case ... | cases.rb:137:6:137:9 | call to expr |
|
||||
| cases.rb:147:1:152:3 | case ... | cases.rb:147:6:147:9 | call to expr |
|
||||
caseNoValues
|
||||
| cases.rb:18:1:22:3 | case ... |
|
||||
caseElseBranches
|
||||
@@ -22,6 +23,7 @@ caseNoElseBranches
|
||||
| cases.rb:116:1:124:3 | case ... |
|
||||
| cases.rb:128:1:133:3 | case ... |
|
||||
| cases.rb:137:1:145:3 | case ... |
|
||||
| cases.rb:147:1:152:3 | case ... |
|
||||
caseWhenBranches
|
||||
| cases.rb:8:1:15:3 | case ... | cases.rb:9:1:10:7 | when ... | 0 | cases.rb:9:6:9:6 | b | cases.rb:9:7:10:7 | then ... |
|
||||
| cases.rb:8:1:15:3 | case ... | cases.rb:11:1:12:7 | when ... | 0 | cases.rb:11:6:11:6 | c | cases.rb:11:10:12:7 | then ... |
|
||||
@@ -121,3 +123,7 @@ caseAllBranches
|
||||
| cases.rb:137:1:145:3 | case ... | 4 | cases.rb:142:3:142:14 | in ... then ... |
|
||||
| cases.rb:137:1:145:3 | case ... | 5 | cases.rb:143:3:143:15 | in ... then ... |
|
||||
| cases.rb:137:1:145:3 | case ... | 6 | cases.rb:144:3:144:23 | in ... then ... |
|
||||
| cases.rb:147:1:152:3 | case ... | 0 | cases.rb:148:3:148:10 | in ... then ... |
|
||||
| cases.rb:147:1:152:3 | case ... | 1 | cases.rb:149:3:149:11 | in ... then ... |
|
||||
| cases.rb:147:1:152:3 | case ... | 2 | cases.rb:150:3:150:11 | in ... then ... |
|
||||
| cases.rb:147:1:152:3 | case ... | 3 | cases.rb:151:3:151:12 | in ... then ... |
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
| cases.rb:116:1:124:3 | case ... | CaseExpr |
|
||||
| cases.rb:128:1:133:3 | case ... | CaseExpr |
|
||||
| cases.rb:137:1:145:3 | case ... | CaseExpr |
|
||||
| cases.rb:147:1:152:3 | case ... | CaseExpr |
|
||||
| conditionals.rb:10:1:12:3 | if ... | IfExpr |
|
||||
| conditionals.rb:15:1:19:3 | if ... | IfExpr |
|
||||
| conditionals.rb:22:1:30:3 | if ... | IfExpr |
|
||||
|
||||
@@ -144,3 +144,9 @@ case expr
|
||||
in Bar( a: 1, **nil);
|
||||
end
|
||||
|
||||
case expr
|
||||
in ^foo;
|
||||
in ^$foo;
|
||||
in ^@foo;
|
||||
in ^@@foo;
|
||||
end
|
||||
Reference in New Issue
Block a user