Skip to content

Commit fe8945b

Browse files
committed
Ruby: Rename getCanonicalEnclosing/Nested module
getCanonicalEnclosingModule -> getParentModule getCanonicalNestedModule -> getNestedModule
1 parent bd2a065 commit fe8945b

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

ruby/ql/lib/codeql/ruby/ast/Module.qll

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -151,24 +151,24 @@ class Module extends TModule {
151151
/**
152152
* Gets the enclosing module, as it appears in the qualified name of this module.
153153
*
154-
* For example, the canonical enclosing module of `A::B` is `A`, and `A` itself has no canonical enclosing module.
154+
* For example, the parent module of `A::B` is `A`, and `A` itself has no parent module.
155155
*/
156156
pragma[nomagic]
157-
Module getCanonicalEnclosingModule() { result.getQualifiedName() = this.getEnclosingModuleName() }
157+
Module getParentModule() { result.getQualifiedName() = this.getEnclosingModuleName() }
158158

159159
/**
160160
* Gets a module named `name` declared inside this one (not aliased), provided
161161
* that such a module is defined or reopened in the current codebase.
162162
*
163-
* For example, for `A::B` the canonical nested module named `C` would be `A::B::C`.
163+
* For example, for `A::B` the nested module named `C` would be `A::B::C`.
164164
*
165165
* Note that this is not the same as constant lookup. If `A::B::C` would resolve to a
166166
* module whose qualified name is not `A::B::C`, then it will not be found by
167167
* this predicate.
168168
*/
169169
pragma[nomagic]
170-
Module getCanonicalNestedModule(string name) {
171-
result.getCanonicalEnclosingModule() = this and
170+
Module getNestedModule(string name) {
171+
result.getParentModule() = this and
172172
result.getOwnModuleName() = name
173173
}
174174
}

ruby/ql/lib/codeql/ruby/dataflow/internal/DataFlowPublic.qll

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -927,7 +927,7 @@ class ModuleNode instanceof Module {
927927
*
928928
* For example, the canonical enclosing module of `A::B` is `A`, and `A` itself has no canonical enclosing module.
929929
*/
930-
ModuleNode getCanonicalEnclosingModule() { result = super.getCanonicalEnclosingModule() }
930+
ModuleNode getCanonicalEnclosingModule() { result = super.getParentModule() }
931931

932932
/**
933933
* Gets a module named `name` declared inside this one (not aliased), provided
@@ -939,7 +939,7 @@ class ModuleNode instanceof Module {
939939
* module whose qualified name is not `A::B::C`, then it will not be found by
940940
* this predicate.
941941
*/
942-
ModuleNode getCanonicalNestedModule(string name) { result = super.getCanonicalNestedModule(name) }
942+
ModuleNode getCanonicalNestedModule(string name) { result = super.getNestedModule(name) }
943943
}
944944

945945
/**
@@ -1152,7 +1152,7 @@ class ConstRef extends LocalSourceNode {
11521152
*/
11531153
predicate isPossiblyGlobal() {
11541154
exists(Module mod |
1155-
not exists(mod.getCanonicalEnclosingModule()) and
1155+
not exists(mod.getParentModule()) and
11561156
mod.getAnImmediateReference() = access
11571157
)
11581158
or
@@ -1237,7 +1237,7 @@ class ConstRef extends LocalSourceNode {
12371237
name = this.getName()
12381238
or
12391239
exists(Module mod |
1240-
this.getExactTarget() = mod.getCanonicalNestedModule(name) and
1240+
this.getExactTarget() = mod.getNestedModule(name) and
12411241
scope = MkExactLookup(mod)
12421242
)
12431243
}

0 commit comments

Comments
 (0)