diff --git a/ql/test/library-tests/ast/Ast.expected b/ql/test/library-tests/ast/Ast.expected index 1085019743b..c6f4dc44656 100644 --- a/ql/test/library-tests/ast/Ast.expected +++ b/ql/test/library-tests/ast/Ast.expected @@ -1370,6 +1370,20 @@ modules/modules.rb: # 56| getAnOperand/getLeftOperand: [GlobalVariableAccess] $global_var # 56| getAnOperand/getRightOperand: [IntegerLiteral] 4 # 60| getStmt: [ModuleDefinition] MyModuleInGlobalScope +# 63| getStmt: [ModuleDefinition] Test +# 65| getStmt: [ModuleDefinition] Foo1 +# 66| getStmt: [ClassDefinition] Bar +# 66| getScopeExpr: [ConstantReadAccess] Foo1 +# 70| getStmt: [ModuleDefinition] Foo2 +# 71| getStmt: [ModuleDefinition] Foo2 +# 72| getStmt: [ClassDefinition] Bar +# 72| getScopeExpr: [ConstantReadAccess] Foo2 +# 76| getStmt: [ModuleDefinition] Foo3 +# 77| getStmt: [AssignExpr] ... = ... +# 77| getAnOperand/getLeftOperand: [ConstantAssignment] Foo3 +# 77| getAnOperand/getRightOperand: [ConstantReadAccess] Object +# 78| getStmt: [ClassDefinition] Bar +# 78| getScopeExpr: [ConstantReadAccess] Foo3 operations/operations.rb: # 1| [Toplevel] operations.rb # 3| getStmt: [AssignExpr] ... = ... diff --git a/ql/test/library-tests/ast/modules/classes.expected b/ql/test/library-tests/ast/modules/classes.expected index 5d9b7dfae33..55923386fe4 100644 --- a/ql/test/library-tests/ast/modules/classes.expected +++ b/ql/test/library-tests/ast/modules/classes.expected @@ -10,8 +10,14 @@ classes | modules.rb:19:3:20:5 | ClassInFoo | ClassDefinition | ClassInFoo | | modules.rb:30:3:31:5 | ClassInAnotherDefinitionOfFoo | ClassDefinition | ClassInAnotherDefinitionOfFoo | | modules.rb:49:3:50:5 | ClassInAnotherDefinitionOfFooBar | ClassDefinition | ClassInAnotherDefinitionOfFooBar | +| modules.rb:66:5:67:7 | Bar | ClassDefinition | Bar | +| modules.rb:72:5:73:7 | Bar | ClassDefinition | Bar | +| modules.rb:78:5:79:7 | Bar | ClassDefinition | Bar | classesWithNameScopeExprs | classes.rb:16:1:17:3 | MyClass | classes.rb:16:7:16:14 | MyModule | +| modules.rb:66:5:67:7 | Bar | modules.rb:66:11:66:14 | Foo1 | +| modules.rb:72:5:73:7 | Bar | modules.rb:72:11:72:14 | Foo2 | +| modules.rb:78:5:79:7 | Bar | modules.rb:78:11:78:14 | Foo3 | classesWithGlobalNameScopeExprs | classes.rb:55:1:56:3 | MyClassInGlobalScope | exprsInClasses diff --git a/ql/test/library-tests/ast/modules/module_base.expected b/ql/test/library-tests/ast/modules/module_base.expected index 99d40f49e22..d63da775d77 100644 --- a/ql/test/library-tests/ast/modules/module_base.expected +++ b/ql/test/library-tests/ast/modules/module_base.expected @@ -11,7 +11,7 @@ moduleBases | classes.rb:41:1:52:3 | class << ... | ClassDefinition | | classes.rb:55:1:56:3 | MyClassInGlobalScope | ClassDefinition | | modules.rb:1:1:2:3 | Empty | ModuleDefinition | -| modules.rb:1:1:61:3 | modules.rb | Toplevel | +| modules.rb:1:1:82:1 | modules.rb | Toplevel | | modules.rb:4:1:24:3 | Foo | ModuleDefinition | | modules.rb:5:3:14:5 | Bar | ModuleDefinition | | modules.rb:6:5:7:7 | ClassInFooBar | ClassDefinition | @@ -22,6 +22,14 @@ moduleBases | modules.rb:48:1:57:3 | Bar | ModuleDefinition | | modules.rb:49:3:50:5 | ClassInAnotherDefinitionOfFooBar | ClassDefinition | | modules.rb:60:1:61:3 | MyModuleInGlobalScope | ModuleDefinition | +| modules.rb:63:1:81:3 | Test | ModuleDefinition | +| modules.rb:65:3:68:5 | Foo1 | ModuleDefinition | +| modules.rb:66:5:67:7 | Bar | ClassDefinition | +| modules.rb:70:3:74:5 | Foo2 | ModuleDefinition | +| modules.rb:71:5:71:19 | Foo2 | ModuleDefinition | +| modules.rb:72:5:73:7 | Bar | ClassDefinition | +| modules.rb:76:3:80:5 | Foo3 | ModuleDefinition | +| modules.rb:78:5:79:7 | Bar | ClassDefinition | | toplevel.rb:1:1:5:23 | toplevel.rb | Toplevel | moduleBaseClasses | classes.rb:2:1:56:3 | classes.rb | classes.rb:3:1:4:3 | Foo | @@ -35,6 +43,9 @@ moduleBaseClasses | modules.rb:5:3:14:5 | Bar | modules.rb:6:5:7:7 | ClassInFooBar | | modules.rb:26:1:35:3 | Foo | modules.rb:30:3:31:5 | ClassInAnotherDefinitionOfFoo | | modules.rb:48:1:57:3 | Bar | modules.rb:49:3:50:5 | ClassInAnotherDefinitionOfFooBar | +| modules.rb:65:3:68:5 | Foo1 | modules.rb:66:5:67:7 | Bar | +| modules.rb:70:3:74:5 | Foo2 | modules.rb:72:5:73:7 | Bar | +| modules.rb:76:3:80:5 | Foo3 | modules.rb:78:5:79:7 | Bar | moduleBaseMethods | classes.rb:20:1:37:3 | Wibble | classes.rb:21:3:23:5 | method_a | | classes.rb:20:1:37:3 | Wibble | classes.rb:25:3:27:5 | method_b | @@ -49,10 +60,15 @@ moduleBaseMethods moduleBaseModules | classes.rb:2:1:56:3 | classes.rb | classes.rb:15:1:15:20 | MyModule | | classes.rb:20:1:37:3 | Wibble | classes.rb:35:3:36:5 | ModuleInWibble | -| modules.rb:1:1:61:3 | modules.rb | modules.rb:1:1:2:3 | Empty | -| modules.rb:1:1:61:3 | modules.rb | modules.rb:4:1:24:3 | Foo | -| modules.rb:1:1:61:3 | modules.rb | modules.rb:26:1:35:3 | Foo | -| modules.rb:1:1:61:3 | modules.rb | modules.rb:37:1:46:3 | Bar | -| modules.rb:1:1:61:3 | modules.rb | modules.rb:48:1:57:3 | Bar | -| modules.rb:1:1:61:3 | modules.rb | modules.rb:60:1:61:3 | MyModuleInGlobalScope | +| modules.rb:1:1:82:1 | modules.rb | modules.rb:1:1:2:3 | Empty | +| modules.rb:1:1:82:1 | modules.rb | modules.rb:4:1:24:3 | Foo | +| modules.rb:1:1:82:1 | modules.rb | modules.rb:26:1:35:3 | Foo | +| modules.rb:1:1:82:1 | modules.rb | modules.rb:37:1:46:3 | Bar | +| modules.rb:1:1:82:1 | modules.rb | modules.rb:48:1:57:3 | Bar | +| modules.rb:1:1:82:1 | modules.rb | modules.rb:60:1:61:3 | MyModuleInGlobalScope | +| modules.rb:1:1:82:1 | modules.rb | modules.rb:63:1:81:3 | Test | | modules.rb:4:1:24:3 | Foo | modules.rb:5:3:14:5 | Bar | +| modules.rb:63:1:81:3 | Test | modules.rb:65:3:68:5 | Foo1 | +| modules.rb:63:1:81:3 | Test | modules.rb:70:3:74:5 | Foo2 | +| modules.rb:63:1:81:3 | Test | modules.rb:76:3:80:5 | Foo3 | +| modules.rb:70:3:74:5 | Foo2 | modules.rb:71:5:71:19 | Foo2 | diff --git a/ql/test/library-tests/ast/modules/modules.expected b/ql/test/library-tests/ast/modules/modules.expected index 1cb4c50c9e7..5bad601a779 100644 --- a/ql/test/library-tests/ast/modules/modules.expected +++ b/ql/test/library-tests/ast/modules/modules.expected @@ -8,6 +8,11 @@ modules | modules.rb:37:1:46:3 | Bar | ModuleDefinition | Bar | | modules.rb:48:1:57:3 | Bar | ModuleDefinition | Bar | | modules.rb:60:1:61:3 | MyModuleInGlobalScope | ModuleDefinition | MyModuleInGlobalScope | +| modules.rb:63:1:81:3 | Test | ModuleDefinition | Test | +| modules.rb:65:3:68:5 | Foo1 | ModuleDefinition | Foo1 | +| modules.rb:70:3:74:5 | Foo2 | ModuleDefinition | Foo2 | +| modules.rb:71:5:71:19 | Foo2 | ModuleDefinition | Foo2 | +| modules.rb:76:3:80:5 | Foo3 | ModuleDefinition | Foo3 | modulesWithScopeExprs | modules.rb:48:1:57:3 | Bar | modules.rb:48:8:48:10 | Foo | modulesWithGlobalNameScopeExprs @@ -34,6 +39,14 @@ exprsInModules | modules.rb:48:1:57:3 | Bar | 1 | modules.rb:52:3:53:5 | method_in_another_definition_of_foo_bar | Method | | modules.rb:48:1:57:3 | Bar | 2 | modules.rb:55:3:55:30 | call to puts | MethodCall | | modules.rb:48:1:57:3 | Bar | 3 | modules.rb:56:3:56:17 | ... = ... | AssignExpr | +| modules.rb:63:1:81:3 | Test | 0 | modules.rb:65:3:68:5 | Foo1 | ModuleDefinition | +| modules.rb:63:1:81:3 | Test | 1 | modules.rb:70:3:74:5 | Foo2 | ModuleDefinition | +| modules.rb:63:1:81:3 | Test | 2 | modules.rb:76:3:80:5 | Foo3 | ModuleDefinition | +| modules.rb:65:3:68:5 | Foo1 | 0 | modules.rb:66:5:67:7 | Bar | ClassDefinition | +| modules.rb:70:3:74:5 | Foo2 | 0 | modules.rb:71:5:71:19 | Foo2 | ModuleDefinition | +| modules.rb:70:3:74:5 | Foo2 | 1 | modules.rb:72:5:73:7 | Bar | ClassDefinition | +| modules.rb:76:3:80:5 | Foo3 | 0 | modules.rb:77:5:77:17 | ... = ... | AssignExpr | +| modules.rb:76:3:80:5 | Foo3 | 1 | modules.rb:78:5:79:7 | Bar | ClassDefinition | methodsInModules | modules.rb:4:1:24:3 | Foo | modules.rb:16:3:17:5 | method_in_foo | method_in_foo | | modules.rb:5:3:14:5 | Bar | modules.rb:9:5:10:7 | method_in_foo_bar | method_in_foo_bar | @@ -46,5 +59,12 @@ classesInModules | modules.rb:5:3:14:5 | Bar | modules.rb:6:5:7:7 | ClassInFooBar | ClassInFooBar | | modules.rb:26:1:35:3 | Foo | modules.rb:30:3:31:5 | ClassInAnotherDefinitionOfFoo | ClassInAnotherDefinitionOfFoo | | modules.rb:48:1:57:3 | Bar | modules.rb:49:3:50:5 | ClassInAnotherDefinitionOfFooBar | ClassInAnotherDefinitionOfFooBar | +| modules.rb:65:3:68:5 | Foo1 | modules.rb:66:5:67:7 | Bar | Bar | +| modules.rb:70:3:74:5 | Foo2 | modules.rb:72:5:73:7 | Bar | Bar | +| modules.rb:76:3:80:5 | Foo3 | modules.rb:78:5:79:7 | Bar | Bar | modulesInModules | modules.rb:4:1:24:3 | Foo | modules.rb:5:3:14:5 | Bar | Bar | +| modules.rb:63:1:81:3 | Test | modules.rb:65:3:68:5 | Foo1 | Foo1 | +| modules.rb:63:1:81:3 | Test | modules.rb:70:3:74:5 | Foo2 | Foo2 | +| modules.rb:63:1:81:3 | Test | modules.rb:76:3:80:5 | Foo3 | Foo3 | +| modules.rb:70:3:74:5 | Foo2 | modules.rb:71:5:71:19 | Foo2 | Foo2 | diff --git a/ql/test/library-tests/ast/modules/modules.rb b/ql/test/library-tests/ast/modules/modules.rb index dfba11f8d6e..2463a699d4d 100644 --- a/ql/test/library-tests/ast/modules/modules.rb +++ b/ql/test/library-tests/ast/modules/modules.rb @@ -58,4 +58,25 @@ end # a module where the name is a scope resolution using the global scope module ::MyModuleInGlobalScope -end \ No newline at end of file +end + +module Test + + module Foo1 + class Foo1::Bar + end + end + + module Foo2 + module Foo2 end + class Foo2::Bar + end + end + + module Foo3 + Foo3 = Object + class Foo3::Bar + end + end +end + diff --git a/ql/test/library-tests/ast/modules/toplevel.expected b/ql/test/library-tests/ast/modules/toplevel.expected index 9ea0f83b3df..dd4576a21a0 100644 --- a/ql/test/library-tests/ast/modules/toplevel.expected +++ b/ql/test/library-tests/ast/modules/toplevel.expected @@ -1,6 +1,6 @@ toplevel | classes.rb:2:1:56:3 | classes.rb | Toplevel | -| modules.rb:1:1:61:3 | modules.rb | Toplevel | +| modules.rb:1:1:82:1 | modules.rb | Toplevel | | toplevel.rb:1:1:5:23 | toplevel.rb | Toplevel | beginBlocks | toplevel.rb:1:1:5:23 | toplevel.rb | 0 | toplevel.rb:5:1:5:22 | BEGIN { ... } |