Commit Graph

73 Commits

Author SHA1 Message Date
Arthur Baars
00260db58f Add Scope.qll 2021-03-09 09:46:42 +01:00
Arthur Baars
b2fbeee794 CFG: hide all non-AstNodes 2021-02-26 19:04:33 +01:00
Arthur Baars
9800e3f930 Add some TODO comments 2021-02-25 13:43:36 +01:00
Arthur Baars
7c0ea7b3bc CFG: add AstNode for @in 2021-02-25 12:57:18 +01:00
Arthur Baars
b16d6bf5b4 CFG: make isValidFor work for hidden nodes 2021-02-25 12:57:18 +01:00
Arthur Baars
999b82ca73 Remove imports of TreeSitter 2021-02-25 12:57:18 +01:00
Arthur Baars
336b310668 AST: improve AST for special parameters 2021-02-24 19:07:16 +01:00
Arthur Baars
cb21e8edda CFG: hide nodes that are not proper AstNodes 2021-02-24 19:07:16 +01:00
Arthur Baars
e1047fad2c CFG: remove intermediate HeredocBody nodes 2021-02-17 13:10:18 +01:00
Arthur Baars
bde04d48a2 Merge pull request #116 from github/aibaars/cfg-loop-post-order
CFG: make loop expressions post order
2021-02-08 09:53:25 +01:00
Arthur Baars
f2a6f3aadc Update comments 2021-02-08 09:47:33 +01:00
Arthur Baars
b553eb6964 CFG: make 'for .. in' post-order
Use the 'in' as the intermediate node that checks whether the Enumerable
has more elements.
2021-02-05 18:23:31 +01:00
Arthur Baars
4ae55a718a CFG: make 'while' post-order 2021-02-05 18:23:31 +01:00
Arthur Baars
62802d53c8 Ensure module/class/methods and their headers belong to the right CfgScope 2021-02-04 15:32:20 +01:00
Nick Rolfe
645b8c2a8a Apply suggestions from code review
Co-authored-by: Arthur Baars <aibaars@github.com>
2021-02-02 17:54:00 +00:00
Nick Rolfe
0649e6c3b0 Update CFG to handle separate superclass node 2021-02-01 14:23:47 +00:00
Tom Hvitved
2077ba4a1f Add SSA library 2021-01-27 10:39:19 +01:00
Tom Hvitved
3a0c9a8104 CFG: Replace special parameters with their identifiers
For example, instead of including `**kwargs` in the CFG, we include `kwargs`.
This means that all variable accesses belonging to parameter definitions will
be included in the CFG.
2021-01-25 10:02:21 +01:00
Nick Rolfe
2e8d154f2b Add AST classes and tests for method calls 2021-01-20 18:34:25 +00:00
Tom Hvitved
34fe416a85 CFG: Fix bug in LogicalNotTree 2021-01-18 15:03:58 +01:00
Nick Rolfe
6c0804c1af Address feedback on CFG change 2021-01-07 19:02:37 +00:00
Nick Rolfe
7c503120ae Add AST library for control expressions (conditionals and loops) 2021-01-05 16:08:33 +00:00
Arthur Baars
bf232f0582 Update formatting for CodeQL 2.4.1 2020-12-21 10:45:59 +01:00
Arthur Baars
8f1c916242 Merge pull request #66 from github/aibaars/cfg-2
CFG: make all simple nodes instance of StandardLeftToRight{Pre,Post}Tree
2020-12-18 13:26:05 +01:00
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
ff751b97d2 CFG: make all simple nodes instance of StandardLeftToRight{Pre,Post}Tree 2020-12-17 16:39:54 +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
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
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
Tom Hvitved
9aadeedeb9 CFG: Model IfElsifAstNode in post-order 2020-12-15 17:00:12 +01: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
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
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
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