Arthur Baars
46063c7d04
Ruby: update expected output
2023-01-13 10:22:41 +01:00
erik-krogh
8ab31bbe1c
have getMethodName return the method being called for super-calls
2022-12-07 14:09:36 +01:00
Harry Maclean
375403fb9d
Merge pull request #11114 from hmac/case-barrier-guard-3
...
Ruby: Add case string comparison barrier guard
2022-11-30 11:21:07 +13:00
Tom Hvitved
2fac505221
Ruby: Update expected test output
2022-11-21 12:52:27 +01:00
Tom Hvitved
f24fa402f3
Adjust CFG
2022-11-17 10:32:28 +01:00
Harry Maclean
e25e192ef3
Ruby: Change the CFG for while clauses
...
The `when` node now acts as a join point for patterns in the when
clause, with match/no-match completions. This is similar to how `or`
expressions work.
The result of this is that the `when` clause "controls" the body of the
`when`, which allows us to model barrier guards for multi-pattern when
clauses.
For this code
case x
when 1, 2
y
end
The old CFG was
x --> when --> 1 --no-match--> 2 ---no-match---> case
\ \ ^
\ \ |
\ --match----+ |
\ | |
\ | |
------match---------> y --+
The new CFG is
x --> 1 --no-match--> 2 --no-match--> [no-match] when --no-match--> case
\ \ ^
\ \ |
\ --match--> [match] when --match--> y -----+
\ /
\ /
-------match-----
i.e. all patterns flow to the `when` node, which is split based on
whether the pattern matched or not. The body of the when clause then has
a single predecessor `[match] when`, which acts as condition block that
controls `y`.
2022-11-11 11:52:27 +13:00
Arthur Baars
b3855b089a
Ruby: some more tests
2022-10-22 14:15:29 +02:00
Arthur Baars
ccaa12998d
Ruby: desugar compound constant-assignments
2022-10-22 01:11:35 +02:00
Asger F
038bdecad7
Ruby: add test with compound assignment to a constant
2022-10-21 09:20:03 +02:00
Arthur Baars
a8fdda65fb
Ruby: fix self variables in blocks
2022-10-14 16:02:39 +02:00
Arthur Baars
a080f498be
Ruby: fix CFG and toString for anonymous '*' and '**'
2022-10-05 11:50:37 +02:00
Arthur Baars
4ff85d5275
Ruby: add test case
2022-10-05 10:57:53 +02:00
Arthur Baars
68aeb2ba85
Update test output
2022-05-20 16:30:58 +02:00
Arthur Baars
e1e13b599a
Fix CFG
2022-05-11 12:09:17 +02:00
Arthur Baars
dbd9c1859d
Add more test cases for &. operator
2022-05-11 12:06:08 +02:00
Arthur Baars
d055f9a186
Update tests
2022-04-28 13:47:10 +02:00
Arthur Baars
06a99c3987
Ruby: fix location of setter-call argument
2022-03-23 12:55:52 +01:00
Nick Rolfe
94ce578ea4
Ruby: implement getComponent(n) for simple and hash-key symbols
2022-03-16 11:43:46 +00:00
Nick Rolfe
990e07b986
Ruby/C#: add semmle.order attribute to edges in CFG tests
2022-01-31 20:08:24 +00:00
Nick Rolfe
6f06263d49
Ruby: add more properties for ordering nodes in graph tests
2022-01-27 13:57:43 +00:00
Tom Hvitved
dd27ed8392
Ruby: Desugar hash literals
...
```rb
{ a: 1, **splat, b: 2 }
```
becomes
```rb
::Hash.[](a: 1, **splat, b: 2)
```
2022-01-26 13:53:18 +01:00
Arthur Baars
7630b277b8
Ruby: update AST and CFG test data
2022-01-24 10:31:08 +01:00
Arthur Baars
77a3e4bd61
Ruby: CFG: fix completion of AsPattern variable
2022-01-24 10:10:22 +01:00
Tom Hvitved
322f8356dd
Ruby: Include StringComponents in the CFG
2022-01-06 12:27:03 +13:00
Arthur Baars
7644d60dae
Revert "Ruby: CFG: make WhenExpr post-order"
...
This reverts commit cff63fa7d7 .
2021-12-20 18:57:25 +01:00
Arthur Baars
974ad070d1
Revert "Ruby: CFG make in-clause post-order"
...
This reverts commit 1343ed58a21eec2954876d8d42e877a382ba89c8.
2021-12-17 14:04:25 +01:00
Arthur Baars
ba89653dff
Ruby: CFG: make RescueClause post-order
2021-12-17 12:21:18 +01:00
Arthur Baars
db4b781fef
Ruby: CFG: make RescueModifier post-order
2021-12-17 12:21:18 +01:00
Arthur Baars
cff63fa7d7
Ruby: CFG: make WhenExpr post-order
2021-12-17 12:21:18 +01:00
Arthur Baars
a9286e897b
Ruby: CFG make in-clause post-order
2021-12-17 12:21:18 +01:00
Arthur Baars
f49605569b
Ruby: CFG make more expressions post-order
2021-12-17 12:21:18 +01:00
Arthur Baars
a4ea7129c2
Ruby: CFG: make 'case' a PostOrder node
2021-12-17 12:21:18 +01:00
Tom Hvitved
9ea8b20e77
Ruby: Deprecate Pattern classes
2021-12-14 15:04:40 +01:00
Arthur Baars
a7b3f1370f
Ruby: CFG: add test case
2021-12-09 15:23:26 +01:00
Tom Hvitved
b887165005
Ruby: Code review suggestions
2021-12-09 15:23:26 +01:00
Arthur Baars
660e52f2bf
Ruby: CFG: make VariableReferencePattern a PreOrder node
2021-12-09 15:23:26 +01:00
Arthur Baars
aacba0b522
Ruby: CFG: add test cases for pattern matching
2021-12-09 15:23:26 +01:00
Harry Maclean
6f42153eac
Ruby: Include empty StmtSequences in CFG
...
Empty StmtSequences appear, for example, in the `else` branch of `if`
statements like the following:
foo
if cond
bar
else
end
baz
Before this change, the CFG for this code would look like this:
foo
│
│
▼
cond
│
true │
▼
bar
│
│
▼
if
│
│
▼
baz
i.e. there is linear flow through the condition, the `then` branch, and
out of the if. This doesn't account for the possibility that the
condition is false and `bar` is not executed. After this change, the CFG
looks like this:
foo
│
│
▼
cond
│ │
true │ │ false
▼ │
bar │
│ │
│ │
▼ ▼
if
│
│
▼
baz
i.e. we correctly account for the `false` condition.
2021-12-07 16:01:50 +13:00
Tom Hvitved
50dd4e7ee7
Ruby: Add CFG test for ||
2021-12-03 09:16:11 +01:00
Tom Hvitved
4d918b5e5f
Ruby: Fix CFG splitting logic for ensure blocks with loops
2021-11-23 15:21:43 +01:00
Tom Hvitved
9d072a12ed
Merge pull request #7098 from github/ruby/desugar-for-1
...
Ruby: Desugar `for` loops as calls to `each`
2021-11-23 11:35:49 +01:00
Harry Maclean
90a9688310
Ruby: update CFG fixture
2021-11-19 11:31:14 +00:00
Harry Maclean
8fd8c9b04d
Fix CallExprCfgNode.getKeywordArgument
...
This predicate now produces results.
2021-11-19 11:28:08 +00:00
Harry Maclean
0caea17118
Add a test for CallCfgNodes
...
This test shows that `CallCfgNode.getKeywordArgument(string keyword)`
doesn't return any results.
2021-11-19 11:28:07 +00:00
Tom Hvitved
de72a765e0
Ruby: Update expected CFG test output (reordering)
2021-11-17 13:44:55 +01:00
Tom Hvitved
08c778241d
Ruby: Adopt to changes after rebase
2021-11-17 09:17:32 +01:00
Tom Hvitved
413375992d
Ruby: Flatten nested statements inside desugared for loops
2021-11-17 09:05:37 +01:00
Tom Hvitved
92453bd2c5
Ruby: Rewrite break_ensure.rb CFG test to use while loops instead of for loops
2021-11-17 09:05:37 +01:00
Tom Hvitved
945bb7459a
Ruby: Update expected test output
2021-11-17 09:05:37 +01:00
Alex Ford
8603609698
Update test output to account for for-loop -> each desugaring
2021-11-17 09:05:36 +01:00