Skip to content

Commit 907c3db

Browse files
aibaarsnickrolfe
andcommitted
Address comments
Co-authored-by: Nick Rolfe <nickrolfe@github.com>
1 parent 19e4d34 commit 907c3db

File tree

3 files changed

+19
-10
lines changed

3 files changed

+19
-10
lines changed

ruby/ql/lib/codeql/ruby/ast/Method.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ class Lambda extends Callable, BodyStmt, TLambda {
253253
/** A block. */
254254
class Block extends Callable, StmtSequence, Scope, TBlock {
255255
/**
256-
* Get a local variable declared by this block.
256+
* Gets a local variable declared by this block.
257257
* For example `local` in `{ | param; local| puts param }`.
258258
*/
259259
LocalVariableWriteAccess getALocalVariable() { result = this.getLocalVariable(_) }

ruby/ql/lib/upgrades/9fdd1d40fd3c3f8f9db8fabf5a353580d14c663a/ruby_call_method.ql

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,6 @@ class NormalRubyCall extends RubyCall, @ruby_call {
1818
override RubyMethod getMethod() { result = method }
1919
}
2020

21-
class ImplicitRubyCall extends RubyCall, @ruby_call {
22-
ImplicitRubyCall() { ruby_call_def(this, any(@ruby_argument_list a)) }
23-
24-
override RubyMethod getMethod() { none() }
25-
}
26-
2721
class ScopeResolutionCall extends RubyCall, @ruby_scope_resolution {
2822
private @ruby_token_identifier method;
2923

ruby/ql/test/library-tests/ast/TreeSitter.ql

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,37 @@
22
* @kind graph
33
*/
44

5-
import codeql.ruby.ast.internal.TreeSitter::Ruby
5+
import codeql.ruby.ast.internal.TreeSitter
6+
import codeql.Locations
67

78
/**
89
* Holds if `node` belongs to the output tree, and its property `key` has the
910
* given `value`.
1011
*/
11-
query predicate nodes(AstNode node, string key, string value) {
12+
query predicate nodes(Ruby::AstNode node, string key, string value) {
1213
key = "semmle.label" and
1314
value = "[" + node.getPrimaryQlClasses() + "] " + node.toString()
15+
or
16+
key = "semmle.order" and
17+
value =
18+
any(int i |
19+
node =
20+
rank[i](Ruby::AstNode n, Location l |
21+
l = n.getLocation()
22+
|
23+
n
24+
order by
25+
l.getFile().getRelativePath(), l.getFile().getAbsolutePath(), l.getStartLine(),
26+
l.getStartColumn(), l.getEndLine() desc, l.getEndColumn() desc, n.toString()
27+
)
28+
).toString()
1429
}
1530

1631
/**
1732
* Holds if `target` is a child of `source` in the AST, and property `key` of
1833
* the edge has the given `value`.
1934
*/
20-
query predicate edges(AstNode source, AstNode target, string key, string value) {
35+
query predicate edges(Ruby::AstNode source, Ruby::AstNode target, string key, string value) {
2136
source = target.getParent() and
2237
key = ["semmle.label", "semmle.order"] and
2338
value = target.getParentIndex().toString()

0 commit comments

Comments
 (0)