Commit Graph

98 Commits

Author SHA1 Message Date
Nick Rolfe
a0084b7732 Simplify CFG tree classes for calls 2021-05-05 17:18:44 +01:00
Nick Rolfe
569063ca73 Make YieldCallTree post-order 2021-05-05 17:14:32 +01:00
Nick Rolfe
9540125771 Remove fromGeneratedInclSynth predicate 2021-04-29 13:58:16 +01:00
Nick Rolfe
f3852f9b56 Create synthetic self nodes for calls without explicit receivers 2021-04-28 16:43:40 +01:00
Arthur Baars
ceb2eb21d8 Address comments 2021-04-08 15:11:57 +02:00
Arthur Baars
063b085078 Address comments 2021-04-07 15:57:13 +02:00
Arthur Baars
eebbc7e505 AST: rename Class/Module to ClassDefinition/ModuleDefinition 2021-03-30 15:40:01 +02:00
Tom Hvitved
0bb5007103 Reintroduce hidden then/else/do in AST; include all in CFG 2021-03-25 14:22:35 +01:00
Tom Hvitved
58ecd771d3 AST: Exclude empty then/else/do statements 2021-03-25 09:53:55 +01:00
Tom Hvitved
ca7c0584c7 CFG: Remove isHidden() predicate 2021-03-24 17:22:05 +01:00
Nick Rolfe
cf7ce911bc Combine CfgScope classes for BodyStmt ∩ Callable 2021-03-19 16:08:43 +00:00
Nick Rolfe
7667606b89 Replace some uses of Generated types 2021-03-19 14:31:17 +00:00
Nick Rolfe
21192bf43c Remove outdated comment 2021-03-19 14:28:26 +00:00
Nick Rolfe
f37c862c92 Rename MandatoryParameterTree to NonDefaultValueParameterTree 2021-03-19 14:27:29 +00:00
Nick Rolfe
c6958f64e4 Make CFG for AssignExpr visit left operand before right 2021-03-19 14:25:38 +00:00
Nick Rolfe
f381f94bc2 Rename ProgramScope to ToplevelScope 2021-03-19 14:02:54 +00:00
Nick Rolfe
37435764a0 Fix control-flow for empty classes and modules 2021-03-18 18:58:40 +00:00
Nick Rolfe
434d9e54a1 Fix complex symbols having multiple ControlFlowTree implementations 2021-03-18 14:48:08 +00:00
Nick Rolfe
4ce7faf868 Fix erroneous flow from 'raise' call to StmtSequence 2021-03-18 13:01:27 +00:00
Nick Rolfe
c8eab42c1d Minor comment fixes 2021-03-18 11:09:21 +00:00
Tom Hvitved
3bb2c529a5 CFG: Revert change to mandatory parameters 2021-03-18 10:43:10 +01:00
Nick Rolfe
32e2b257bf Port CFG implementation to public AST interface 2021-03-17 20:28:47 +00:00
Tom Hvitved
eb7610c55f Rename (to|from)TreeSitter to (to|from)Generated 2021-03-17 09:28:23 +01:00
Tom Hvitved
5724112513 Address review comments 2021-03-17 09:28:18 +01:00
Tom Hvitved
7eaf02a0bf Make external AstNode an IPA type 2021-03-16 12:50:20 +01:00
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