Skip to content
Merged
Changes from 1 commit
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
dca10f8
C#: Add extended_type to the DB scheme.
michaelnebel Feb 4, 2026
c68cd58
C#: Add parameter marker interface, allow a type to a parent for para…
michaelnebel Feb 4, 2026
60bb9a9
C#: Move some populate methods and location writing methods.
michaelnebel Feb 4, 2026
ab505e3
C#: Add class for making synthetic parameter entities.
michaelnebel Feb 4, 2026
edfdc98
C#: Extract extension types and members. Replacing invocations to sta…
michaelnebel Feb 4, 2026
9a4a6cf
C#: Add ExtensionType to the QL library.
michaelnebel Feb 4, 2026
b9f36f3
C#: Add extension callable and accessor classes.
michaelnebel Feb 4, 2026
5e02a86
C#: Add extension call classes.
michaelnebel Feb 4, 2026
e831c80
C#: Replace extension parameter access with the corresponding synthet…
michaelnebel Feb 4, 2026
849823e
C#: Add dispatch logic for calling extensions accessors as methods.
michaelnebel Feb 4, 2026
c040daa
C#: Add extensions test.
michaelnebel Feb 4, 2026
6cbe000
C#: Add PrintAst test for extensions.
michaelnebel Feb 4, 2026
4b6a53b
C#: Add extension data flow test.
michaelnebel Feb 4, 2026
bd3e4d3
C#: Add MaD tests for extensions.
michaelnebel Feb 4, 2026
02e4a8b
C#: Add change-note.
michaelnebel Feb 5, 2026
fe94b3b
C#: Address review comments.
michaelnebel Feb 9, 2026
bcdbd6e
C#: Use the fully qualified name for the extension type when printing…
michaelnebel Feb 9, 2026
d9fea15
C#: Update MaD models for extension members.
michaelnebel Feb 9, 2026
eff9f99
C#: Update test expected output.
michaelnebel Feb 9, 2026
42d2de8
C#: Add DB upgrade script.
michaelnebel Feb 9, 2026
3e914f7
C#: Add DB downgrade script.
michaelnebel Feb 9, 2026
bee1718
QL4QL: Allow Impl classes to implement getAPrimaryQLClass with non Im…
michaelnebel Feb 9, 2026
25b836b
C#: Apply suggestions from code review
michaelnebel Feb 10, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions csharp/ql/lib/semmle/code/csharp/exprs/Access.qll
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,42 @@ class ParameterAccess extends LocalScopeVariableAccess, @parameter_access_expr {
override string getAPrimaryQlClass() { result = "ParameterAccess" }
}

/**
* An access to a synthetic parameter for an extension method, for example the
* access to `s` on line 3 in
*
* ```csharp
* static class MyExtensions {
* extension(string s) {
* public bool IsEmpty() { return s == string.Empty; }
* }
* }
* ```
*/
class SyntheticExtensionParameterAccess extends ParameterAccess {
private Parameter p;

SyntheticExtensionParameterAccess() {
exists(ExtensionType et |
p = et.getReceiverParameter() and
expr_access(this, p)
)
}

override Parameter getTarget() {
exists(ExtensionCallable c |
this.getEnclosingCallable+() = c and
result = c.getParameter(0)
)
}

override string toString() {
result = "access to extension synthetic parameter " + this.getTarget().getName()
}

override string getAPrimaryQlClass() { result = "SyntheticExtensionParameterAccess" }
}

/**
* An access to a parameter that reads the underlying value, for example
* the access to `p` on line 2 in
Expand Down