Skip to content

Commit db6f843

Browse files
committed
Ruby: Hide SynthBlock from the public API
1 parent 8603609 commit db6f843

File tree

2 files changed

+23
-19
lines changed

2 files changed

+23
-19
lines changed

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

Lines changed: 3 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ private import codeql.ruby.AST
22
private import codeql.ruby.controlflow.ControlFlowGraph
33
private import internal.AST
44
private import internal.TreeSitter
5+
private import internal.Method
56

67
/** A callable. */
78
class Callable extends StmtSequence, Expr, Scope, TCallable {
@@ -182,6 +183,8 @@ class Block extends Callable, StmtSequence, Scope, TBlock {
182183
or
183184
result = StmtSequence.super.getAChild(pred)
184185
}
186+
187+
override string getAPrimaryQlClass() { result = "Block" }
185188
}
186189

187190
/** A block enclosed within `do` and `end`. */
@@ -226,22 +229,3 @@ class BraceBlock extends Block, TBraceBlock {
226229

227230
final override string getAPrimaryQlClass() { result = "BraceBlock" }
228231
}
229-
230-
/**
231-
* A synthesized block, such as the block synthesized from the body of
232-
* a `for` loop.
233-
*/
234-
class SynthBlock extends Block, TBlockSynth {
235-
SynthBlock() { this = TBlockSynth(_, _) }
236-
237-
final override Parameter getParameter(int n) { synthChild(this, n, result) }
238-
239-
final override Stmt getStmt(int i) {
240-
i >= 0 and
241-
synthChild(this, i + this.getNumberOfParameters(), result)
242-
}
243-
244-
final override string toString() { result = "{ ... }" }
245-
246-
final override string getAPrimaryQlClass() { result = "SynthBlock" }
247-
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
private import codeql.ruby.AST
2+
private import AST
3+
private import TreeSitter
4+
5+
/**
6+
* A synthesized block, such as the block synthesized from the body of
7+
* a `for` loop.
8+
*/
9+
class SynthBlock extends Block, TBlockSynth {
10+
SynthBlock() { this = TBlockSynth(_, _) }
11+
12+
final override Parameter getParameter(int n) { synthChild(this, n, result) }
13+
14+
final override Stmt getStmt(int i) {
15+
i >= 0 and
16+
synthChild(this, i + this.getNumberOfParameters(), result)
17+
}
18+
19+
final override string toString() { result = "{ ... }" }
20+
}

0 commit comments

Comments
 (0)