Address comments

Co-authored-by: Nick Rolfe <nickrolfe@github.com>
This commit is contained in:
Arthur Baars
2022-05-10 14:27:32 +02:00
parent 19e4d34581
commit 907c3db5ca
3 changed files with 19 additions and 10 deletions

View File

@@ -253,7 +253,7 @@ class Lambda extends Callable, BodyStmt, TLambda {
/** A block. */
class Block extends Callable, StmtSequence, Scope, TBlock {
/**
* Get a local variable declared by this block.
* Gets a local variable declared by this block.
* For example `local` in `{ | param; local| puts param }`.
*/
LocalVariableWriteAccess getALocalVariable() { result = this.getLocalVariable(_) }

View File

@@ -18,12 +18,6 @@ class NormalRubyCall extends RubyCall, @ruby_call {
override RubyMethod getMethod() { result = method }
}
class ImplicitRubyCall extends RubyCall, @ruby_call {
ImplicitRubyCall() { ruby_call_def(this, any(@ruby_argument_list a)) }
override RubyMethod getMethod() { none() }
}
class ScopeResolutionCall extends RubyCall, @ruby_scope_resolution {
private @ruby_token_identifier method;

View File

@@ -2,22 +2,37 @@
* @kind graph
*/
import codeql.ruby.ast.internal.TreeSitter::Ruby
import codeql.ruby.ast.internal.TreeSitter
import codeql.Locations
/**
* Holds if `node` belongs to the output tree, and its property `key` has the
* given `value`.
*/
query predicate nodes(AstNode node, string key, string value) {
query predicate nodes(Ruby::AstNode node, string key, string value) {
key = "semmle.label" and
value = "[" + node.getPrimaryQlClasses() + "] " + node.toString()
or
key = "semmle.order" and
value =
any(int i |
node =
rank[i](Ruby::AstNode n, Location l |
l = n.getLocation()
|
n
order by
l.getFile().getRelativePath(), l.getFile().getAbsolutePath(), l.getStartLine(),
l.getStartColumn(), l.getEndLine() desc, l.getEndColumn() desc, n.toString()
)
).toString()
}
/**
* Holds if `target` is a child of `source` in the AST, and property `key` of
* the edge has the given `value`.
*/
query predicate edges(AstNode source, AstNode target, string key, string value) {
query predicate edges(Ruby::AstNode source, Ruby::AstNode target, string key, string value) {
source = target.getParent() and
key = ["semmle.label", "semmle.order"] and
value = target.getParentIndex().toString()