Skip to content

Commit a15a066

Browse files
authored
Merge pull request #72 from github/aibaars/fix-cfg
CFG improvements
2 parents edbd997 + b676c95 commit a15a066

File tree

9 files changed

+1050
-490
lines changed

9 files changed

+1050
-490
lines changed

.github/workflows/dataset_measure.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ jobs:
2222

2323
- name: Fetch CodeQL
2424
run: |
25-
gh release download --repo https://github.com/github/codeql-cli-binaries --pattern codeql-linux64.zip
25+
LATEST=$(gh release list --repo https://github.com/github/codeql-cli-binaries | cut -f 1 | sort --version-sort | tail -1)
26+
gh release download --repo https://github.com/github/codeql-cli-binaries --pattern codeql-linux64.zip "$LATEST"
2627
unzip -q codeql-linux64.zip
2728
env:
2829
GITHUB_TOKEN: ${{ github.token }}

.github/workflows/qltest.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ jobs:
1616
- uses: actions/checkout@v2
1717
- name: Fetch CodeQL
1818
run: |
19-
gh release download --repo https://github.com/github/codeql-cli-binaries --pattern codeql-linux64.zip
19+
LATEST=$(gh release list --repo https://github.com/github/codeql-cli-binaries | cut -f 1 | sort --version-sort | tail -1)
20+
gh release download --repo https://github.com/github/codeql-cli-binaries --pattern codeql-linux64.zip "$LATEST"
2021
unzip -q codeql-linux64.zip
2122
env:
2223
GITHUB_TOKEN: ${{ github.token }}

ql/src/codeql_ruby/controlflow/ControlFlowGraph.qll

Lines changed: 6 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -8,36 +8,14 @@ private import internal.ControlFlowGraphImpl
88
private import internal.Splitting
99
private import internal.Completion
1010

11-
private class CfgScopeRange =
12-
@program or @begin_block or @end_block or @method or @singleton_method or @block or @do_block or
13-
@lambda;
14-
1511
/** An AST node with an associated control-flow graph. */
16-
class CfgScope extends AstNode, CfgScopeRange {
12+
class CfgScope extends AstNode {
13+
CfgScope::Range_ range;
14+
15+
CfgScope() { range = this }
16+
1717
/** Gets the name of this scope. */
18-
string getName() {
19-
this instanceof Program and
20-
result = "top-level"
21-
or
22-
this instanceof BeginBlock and
23-
result = "BEGIN block"
24-
or
25-
this instanceof EndBlock and
26-
result = "END block"
27-
or
28-
result = this.(Method).getName().toString()
29-
or
30-
result = this.(SingletonMethod).getName().toString()
31-
or
32-
this instanceof Block and
33-
result = "block"
34-
or
35-
this instanceof DoBlock and
36-
result = "do block"
37-
or
38-
this instanceof Lambda and
39-
result = "lambda"
40-
}
18+
string getName() { result = range.getName() }
4119
}
4220

4321
/**

0 commit comments

Comments
 (0)