Commit Graph

196 Commits

Author SHA1 Message Date
Nick Rolfe
e87bf57bc5 Avoid recursion in IPA construction 2021-04-29 18:04:15 +01:00
Nick Rolfe
bd6fe41388 Merge IPA branches for implicit self 2021-04-29 15:38:58 +01:00
Nick Rolfe
59c83b7b8f Add clarifying comment 2021-04-29 14:00:27 +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
549e5ab9d6 Revert "Rename Method -> MethodDeclaration"
This reverts commit d361ef37af.
2021-04-21 10:50:47 +02:00
Arthur Baars
122315db3f Remove 'Method' class 2021-04-20 13:41:11 +02:00
Arthur Baars
bf4f91e038 Address comments 2021-04-16 16:37:42 +02:00
Arthur Baars
bf556a2b53 Implement method lookup 2021-04-15 11:32:43 +02:00
Arthur Baars
5837af0936 Add MethodBase::getMethod 2021-04-15 11:32:43 +02:00
Arthur Baars
d361ef37af Rename Method -> MethodDeclaration 2021-04-15 11:32:43 +02:00
Arthur Baars
24bb11b20a Improve module/class resolution 2021-04-14 17:14:38 +02:00
Arthur Baars
9afda342bc Address comments 2021-04-14 09:57:49 +02:00
Arthur Baars
754bfdd136 Ignore include/prepend statements in blocks
Include and prepend statements are rarely used in block in normal code and when
used in normal code they tend to be in blocks that are passed to methods like
`module_eval` which is a builtin method that evaluates a block in the context
of some other module (typically created with Module.new). We currently don't attempt
to track such "dynamically" constructed modules, and ignoring such modules
 and the `module_eval` calls on them seems fine for now.

Another, much more frequent use of include/prepend statements in blocks is in Rspec.describe and
Rspec.context method calls in tests. Rspec also evaluates those blocks in the context of some
special Rspec class. Precisely tracking such calls during the initial construction of the module/class
hierarchy would be really hard and there would be little benefit because the interesting modules and classes of
an application are not defined in test files.
2021-04-14 09:53:19 +02:00
Arthur Baars
cdfabbc95d Make Cached module private 2021-04-09 16:47:02 +02:00
Arthur Baars
a247544fc5 Add comments 2021-04-09 16:35:23 +02:00
Arthur Baars
7bc5be93ff Module: make main predicates cached 2021-04-09 13:29:27 +02:00
Arthur Baars
2db999d0da Improve module resolution 2021-04-09 09:51:24 +02:00
Arthur Baars
ceb2eb21d8 Address comments 2021-04-08 15:11:57 +02:00
Arthur Baars
84f6e902ea AST: move some scope related methods to AstNode 2021-04-07 17:16:10 +02:00
Arthur Baars
063b085078 Address comments 2021-04-07 15:57:13 +02:00
Arthur Baars
50b8b6b257 Also resolve constants with respect to the ancestors
of the enclosing module.
2021-04-06 15:47:13 +02:00
Arthur Baars
f12e6ea8ea Avoid 'Object::' prefixes 2021-03-30 16:14:21 +02:00
Arthur Baars
201c1e4b81 Basic module resolution 2021-03-30 15:40:03 +02:00
Arthur Baars
ea9afcd4e1 AST: make some classes instance of Scope 2021-03-30 15:40:03 +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
2891d94f99 Improve performance of HereDoc::getBody()
Gets rid of
```
[2021-03-23 10:07:49] (138s) Tuple counts for Literal::HereDoc::getBody_dispred#ff#shared#1/4@1cc5b9:
                      11294    ~0%        {1} r1 = SCAN AST::Cached::THereDoc#ff@staged_ext OUTPUT In.0
                      11294    ~388%      {1} r2 = JOIN r1 WITH Literal::HereDoc::getBody_dispred#ff#join_rhs ON FIRST 1 OUTPUT Rhs.1 'arg1'
                      95514613 ~2080%     {4} r3 = JOIN r2 WITH locations_default_1023#join_rhs ON FIRST 1 OUTPUT Rhs.1 'arg0', Lhs.0 'arg1', Rhs.2 'arg2', Rhs.3 'arg3'
```
2021-03-23 10:31:48 +01:00
Nick Rolfe
e7f1ae8c96 Merge remote-tracking branch 'origin/main' into parent_child 2021-03-22 14:58:33 +00:00
Tom Hvitved
e175513293 Remove duplicate tuple patterns 2021-03-19 10:52:29 +01:00
Nick Rolfe
ceda7c8fd2 Generalise splitting of parenthesized exprs to all statement sequences 2021-03-18 11:21:11 +00:00
Nick Rolfe
32e2b257bf Port CFG implementation to public AST interface 2021-03-17 20:28:47 +00:00
Tom Hvitved
39aa2c6e53 Rework IPA injectors for constant accesses 2021-03-17 14:27:21 +01: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
cde496cc4c Merge pull request #152 from github/aibaars/fix-vars
Fix VariableRead/WriteAcess for instance and class variables
2021-03-11 17:05:56 +01:00
Arthur Baars
6a284378d6 Update ql/src/codeql_ruby/ast/Scope.qll
Co-authored-by: Nick Rolfe <nickrolfe@github.com>
2021-03-09 18:57:24 +01:00
Arthur Baars
f28071ceb6 Fix VariableRead/WriteAcess for instance and class variables 2021-03-09 13:55:55 +01:00
Arthur Baars
600d9c66ae Remove VariableScope 2021-03-09 11:56:17 +01:00
Arthur Baars
86a89ab1fe Remove VariableScope IPA type 2021-03-09 11:48:18 +01:00
Arthur Baars
00260db58f Add Scope.qll 2021-03-09 09:46:42 +01:00
Nick Rolfe
f691ec9e2a Remove overrides of getParent[Index] 2021-03-08 18:25:37 +00:00
Nick Rolfe
9b96bc32cc Add ast_node_parent relation 2021-03-08 18:25:37 +00:00
Arthur Baars
a6bb34c86d AST: add missing getAPrimaryQlClass predicate 2021-02-25 14:59:39 +01:00
Arthur Baars
999b82ca73 Remove imports of TreeSitter 2021-02-25 12:57:18 +01:00
Arthur Baars
87b2c142bc Update qldoc 2021-02-25 10:23:29 +01:00
Arthur Baars
4ba0f3088a Use strictcount 2021-02-25 10:21:07 +01:00
Arthur Baars
0f940349ba AST: rename getExpr predicates to more meaningful names 2021-02-25 10:11:29 +01:00