Commit Graph

115 Commits

Author SHA1 Message Date
Tom Hvitved
07c464b753 CFG: Fix bad join-order
Before:
```
[2020-12-17 11:33:46] (211s) Tuple counts for ControlFlowGraphImpl::Trees::RescueEnsureBlockTree::nestedEnsure_dispred#ff/2@2ea588:
                      11409019   ~0%     {2} r1 = SCAN ControlFlowGraphImpl::getScope#ff AS I OUTPUT I.<1>, I.<0> 'this'
                      3714296409 ~0%     {3} r2 = JOIN r1 WITH ControlFlowGraphImpl::Trees::getAChildInScope#fff_102#join_rhs AS R ON FIRST 1 OUTPUT r1.<1> 'this', R.<1>, R.<2>
                      2359       ~0%     {2} r3 = JOIN r2 WITH ControlFlowGraphImpl::Trees::RescueEnsureBlockTree::getAnEnsureDescendant#ff AS R ON FIRST 2 OUTPUT r2.<2>, r2.<0> 'this'
                      1          ~0%     {2} r4 = JOIN r3 WITH ControlFlowGraphImpl::Trees::RescueEnsureBlockTree::getEnsure_dispred#ff_10#join_rhs AS R ON FIRST 1 OUTPUT r3.<1> 'this', R.<1> 'innerBlock'
                                         return r4
```

After:
```
[2020-12-17 15:20:37] (51s) Tuple counts for ControlFlowGraphImpl::Trees::RescueEnsureBlockTree::nestedEnsure_dispred#ff/2@c4f57d:
                      635      ~1%     {3} r1 = JOIN ControlFlowGraphImpl::Trees::RescueEnsureBlockTree::getEnsure_dispred#ff_10#join_rhs AS L WITH ControlFlowGraphImpl::Trees::getAChildInScope#fff_201#join_rhs AS R ON FIRST 1 OUTPUT R.<1>, L.<1> 'innerBlock', R.<2>
                      1        ~0%     {3} r2 = JOIN r1 WITH ControlFlowGraphImpl::Trees::RescueEnsureBlockTree::getAnEnsureDescendant#ff_10#join_rhs AS R ON FIRST 1 OUTPUT R.<1> 'this', r1.<2>, r1.<1> 'innerBlock'
                      1        ~0%     {2} r3 = JOIN r2 WITH ControlFlowGraphImpl::getScope#ff AS R ON FIRST 2 OUTPUT r2.<0> 'this', r2.<2> 'innerBlock'
                                       return r3
```
2020-12-17 16:46:03 +01:00
Arthur Baars
b676c95218 Address comments 2020-12-17 16:35:51 +01:00
Tom Hvitved
46fc17da58 CFG: Fix multiple abnormal successors 2020-12-17 11:15:17 +01:00
Arthur Baars
dd954ea943 CFG: correct flow for lambda bodies
Lambda bodies are parsed as nested do-blocks or normal blocks.
This is actually incorrect, as the body of a lambda can't have
parameters. However, we can "inline" such blocks to get the
desired control flow.
2020-12-17 10:04:01 +01:00
Arthur Baars
eafec4331b CFG: add nodes for block arguments 2020-12-17 10:04:01 +01:00
Arthur Baars
d016e3cae0 CFG: methods are evaluated before their arguments 2020-12-17 10:04:01 +01:00
Arthur Baars
81c907a87a CFG: fix BEGIN and END blocks 2020-12-17 10:04:01 +01:00
Arthur Baars
f2fd1c7931 CFG: make def nodes visible 2020-12-17 10:04:01 +01:00
Arthur Baars
f2effce786 CFG: improve handling of block and lambda 2020-12-17 10:04:01 +01:00
Arthur Baars
30895e634c CFG: refactor CfgScope 2020-12-17 10:04:01 +01:00
Arthur Baars
69de81bdd5 CFG: have alternative flow for the definition and call of methods etc. 2020-12-17 10:04:01 +01:00
Arthur Baars
fd14770542 CFG: drop getObject from flow of singleton method 2020-12-17 09:59:30 +01:00
Arthur Baars
8501e30b6a CFG: fix linking heredoc start to heredoc body 2020-12-17 09:59:30 +01:00
Nick Rolfe
d1a9572b0e Merge remote-tracking branch 'origin/main' into kinds 2020-12-16 17:55:20 +00:00
Nick Rolfe
0518d51b51 Update CFG: call receiers are evaluated before arguments 2020-12-16 12:40:57 +00:00
Nick Rolfe
e98a84c8b5 Update CFG to match changes to Call/MethodCall 2020-12-16 12:01:30 +00:00
Nick Rolfe
aa0c1491a6 Update tree-sitter-ruby to pick up improvements to calls 2020-12-16 10:13:45 +00:00
Tom Hvitved
9aadeedeb9 CFG: Model IfElsifAstNode in post-order 2020-12-15 17:00:12 +01:00
Nick Rolfe
3f5eab04b5 Create disjoint db types for different operators 2020-12-15 15:22:33 +00:00
Tom Hvitved
16c25f2a4c CFG: Handle ensure blocks without body/rescues 2020-12-15 13:49:14 +01:00
Tom Hvitved
489b406e2a CFG: Change column order in succExit/hasExitScope 2020-12-15 13:45:22 +01:00
Arthur Baars
5108b369e1 Merge pull request #64 from github/hvitved/cfg/rescue
Implement CFG logic for `rescue-ensure`
2020-12-15 11:43:14 +01:00
Tom Hvitved
a76e6848c7 CFG: Address more review comments 2020-12-14 20:45:57 +01:00
Tom Hvitved
ec4ead2117 Apply suggestions from code review
Co-authored-by: Arthur Baars <aibaars@github.com>
2020-12-14 14:53:35 +01:00
Tom Hvitved
89fb2f8498 CFG: Add @kind graph to Cfg.ql, and remove labels from ordinary successor edges 2020-12-14 11:00:26 +01:00
Nick Rolfe
6bacac7598 Bump tree-sitter-ruby revision to get operator_assignment field 2020-12-08 18:28:54 +00:00
Tom Hvitved
b14a889f5f CFG: Use MatchingCompletion for parameters with default values 2020-12-08 13:47:32 +01:00
Tom Hvitved
80a59a81ed CFG: Use MatchingCompletion for patterns 2020-12-08 13:47:32 +01:00
Tom Hvitved
31b8d33a7c CFG: Mark redo edges out of for loops 2020-12-08 13:47:32 +01:00
Tom Hvitved
b6ea5c5eab CFG: Implement logic for rescue-ensure blocks 2020-12-08 13:47:32 +01:00
Nick Rolfe
3145b3dde7 Rename describeQlClass to getAPrimaryQlClass 2020-12-08 11:09:18 +00:00
Arthur Baars
86e73afc74 CFG: extract HeredocBeginning::getName predicate 2020-12-07 16:31:17 +01:00
Arthur Baars
9883d7124e CFG: improve handling of redo 2020-12-07 16:20:42 +01:00
Arthur Baars
003f7230b2 Apply suggestions from code review
Co-authored-by: Tom Hvitved <hvitved@github.com>
2020-12-07 16:02:19 +01:00
Arthur Baars
024150b04b CFG: hide 'begin' 2020-12-07 16:02:19 +01:00
Arthur Baars
87451fd999 CFG: specialise return type instead of instanceof check 2020-12-07 15:36:09 +01:00
Arthur Baars
6aea3eff3e CFG: rename getBody{=>Node} and getCondition{=>Node} 2020-12-07 15:30:57 +01:00
Arthur Baars
6d12bcc2fe Make ConditionalSuccessor not abstract 2020-12-07 15:19:14 +01:00
Arthur Baars
044d14c8b4 Use private imports in generated code 2020-12-07 15:14:34 +01:00
Arthur Baars
ed3b102ecc Improve formatting 2020-12-07 15:12:43 +01:00
Arthur Baars
2394b26636 CFG: skip Uninterpreted nodes 2020-12-07 13:11:21 +01:00
Arthur Baars
36f5a63c18 Improve handling of class, module, block and method 2020-12-07 13:11:21 +01:00
Arthur Baars
ebf3a31224 CFG: don't handle rescue, else, ensure for now 2020-12-07 13:11:21 +01:00
Arthur Baars
97d0220ffd CFG: Model nodes with simple flow 2020-12-07 13:11:21 +01:00
Arthur Baars
3807e1be38 CFG: flow for rescue-modifier 2020-12-07 13:11:21 +01:00
Arthur Baars
d619bdd8f9 CFG: Completions: fix definition of boolean constants 2020-12-07 13:11:21 +01:00
Arthur Baars
6c579ff608 CFG: link heredoc start to its body 2020-12-07 13:11:21 +01:00
Arthur Baars
49d11b1e09 CFG: don't hide Class and Module nodes 2020-12-07 13:11:21 +01:00
Arthur Baars
0852068bcd CFG: make lambda a CFG entry point 2020-12-07 13:11:21 +01:00
Arthur Baars
01066ea3bb CFG: case expression 2020-12-07 13:11:21 +01:00