Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 66eca53

Browse files
committed
Fix accessibility modifier stubbing
1 parent 1aadd3f commit 66eca53

1 file changed

Lines changed: 11 additions & 10 deletions

File tree

csharp/ql/src/Stubs/Stubs.qll

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -81,10 +81,6 @@ abstract private class GeneratedType extends ValueOrRefType, GeneratedElement {
8181
min(this.getLocation().toString()) + "`\n"
8282
}
8383

84-
private string stubAccessibilityModifier() {
85-
if this.isPublic() then result = "public " else result = ""
86-
}
87-
8884
/** Gets the entire C# stub code for this type. */
8985
final string getStub() {
9086
if this.isDuplicate()
@@ -93,15 +89,14 @@ abstract private class GeneratedType extends ValueOrRefType, GeneratedElement {
9389
not this instanceof DelegateType and
9490
result =
9591
this.stubComment() + this.stubAttributes() + this.stubAbstractModifier() +
96-
this.stubStaticModifier() + this.stubAccessibilityModifier() + this.stubKeyword() + " " +
92+
this.stubStaticModifier() + stubAccessibility(this) + this.stubKeyword() + " " +
9793
this.getUndecoratedName() + stubGenericArguments(this) + stubBaseTypesString() +
9894
stubTypeParametersConstraints(this) + "\n{\n" + stubMembers() + "}\n\n"
9995
or
10096
result =
101-
this.stubComment() + this.stubAttributes() + this.stubAccessibilityModifier() +
102-
this.stubKeyword() + " " + stubClassName(this.(DelegateType).getReturnType()) + " " +
103-
this.getUndecoratedName() + stubGenericArguments(this) + "(" + stubParameters(this) +
104-
");\n\n"
97+
this.stubComment() + this.stubAttributes() + stubAccessibility(this) + this.stubKeyword() +
98+
" " + stubClassName(this.(DelegateType).getReturnType()) + " " + this.getUndecoratedName()
99+
+ stubGenericArguments(this) + "(" + stubParameters(this) + ");\n\n"
105100
)
106101
}
107102

@@ -273,7 +268,13 @@ private string stubAccessibility(Member m) {
273268
then result = "public "
274269
else
275270
if m.isProtected()
276-
then result = "protected "
271+
then
272+
if m.isPrivate()
273+
then result = "protected private "
274+
else
275+
if m.isInternal()
276+
then result = "protected internal "
277+
else result = "protected "
277278
else
278279
if m.isPrivate()
279280
then result = "private "

0 commit comments

Comments
 (0)