@@ -138,10 +138,7 @@ class Scope extends Element {
138
138
* Holds if `name` is declared in a nested scope.
139
139
*/
140
140
private predicate isNameDeclaredInNestedScope ( string name ) {
141
- exists ( Scope child |
142
- child .getStrictParent ( ) = this and
143
- child .isNameDeclaredInThisOrNestedScope ( name )
144
- )
141
+ this .getAChildScope ( ) .isNameDeclaredInThisOrNestedScope ( name )
145
142
}
146
143
147
144
/**
@@ -173,7 +170,8 @@ class Scope extends Element {
173
170
}
174
171
175
172
/**
176
- * Gets a variable with `name` which is declared above and hidden by a variable in this or a nested scope.
173
+ * Gets a variable with `name` which is declared in a scope above this one, and hidden by a variable in this or a
174
+ * nested scope.
177
175
*/
178
176
UserVariable getAHidingVariable ( string name ) {
179
177
isNameDeclaredAboveHiddenByThisOrNested ( name ) and
@@ -185,7 +183,7 @@ class Scope extends Element {
185
183
or
186
184
// Declared in a child scope
187
185
exists ( Scope child |
188
- child . getStrictParent ( ) = this and
186
+ getAChildScope ( ) = child and
189
187
child .isNameDeclaredInThisOrNestedScope ( name ) and
190
188
result = child .getAHidingVariable ( name )
191
189
)
@@ -248,8 +246,8 @@ class TranslationUnit extends SourceFile {
248
246
/** Holds if `v2` strictly (`v2` is in an inner scope compared to `v1`) hides `v1`. */
249
247
predicate hides_candidateStrict ( UserVariable v1 , UserVariable v2 ) {
250
248
exists ( Scope s , string name |
251
- v1 = s .getStrictParent ( ) . getAHiddenVariable ( name ) and
252
- v2 = s .getAHidingVariable ( name ) and
249
+ v1 = s .getAHiddenVariable ( name ) and
250
+ v2 = s .getAChildScope ( ) . getAHidingVariable ( name ) and
253
251
not v1 = v2
254
252
) and
255
253
inSameTranslationUnitLate ( v1 .getFile ( ) , v2 .getFile ( ) ) and
0 commit comments