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

Skip to content

Commit 7bf1794

Browse files
committed
Add support for delegate stubbing
1 parent a273f88 commit 7bf1794

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

csharp/ql/src/Stubs/Stubs.qll

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,8 @@ abstract private class GeneratedType extends ValueOrRefType, GeneratedElement {
5757
this instanceof Class and result = "class"
5858
or
5959
this instanceof Enum and result = "enum"
60+
or
61+
this instanceof DelegateType and result = "delegate"
6062
}
6163

6264
private string stubAbstractModifier() {
@@ -87,12 +89,20 @@ abstract private class GeneratedType extends ValueOrRefType, GeneratedElement {
8789
final string getStub() {
8890
if this.isDuplicate()
8991
then result = ""
90-
else
92+
else (
93+
not this instanceof DelegateType and
9194
result =
9295
this.stubComment() + this.stubAttributes() + this.stubAbstractModifier() +
9396
this.stubStaticModifier() + this.stubAccessibilityModifier() + this.stubKeyword() + " " +
9497
this.getUndecoratedName() + stubGenericArguments(this) + stubBaseTypesString() +
9598
stubTypeParametersConstraints(this) + "\n{\n" + stubMembers() + "}\n\n"
99+
or
100+
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"
105+
)
96106
}
97107

98108
private ValueOrRefType getAnInterestingBaseType() {

0 commit comments

Comments
 (0)