Skip to content

Commit 17a2ee7

Browse files
committed
C#: Minor improvements to the QL implementation.
1 parent e4b96e9 commit 17a2ee7

File tree

6 files changed

+22
-15
lines changed

6 files changed

+22
-15
lines changed

csharp/ql/lib/semmle/code/csharp/Callable.qll

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -580,6 +580,7 @@ class RecordCloneMethod extends Method {
580580

581581
/**
582582
* An extension operator, for example `*` in
583+
*
583584
* ```csharp
584585
* static class MyExtensions {
585586
* extension(string s) {

csharp/ql/lib/semmle/code/csharp/Member.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -469,7 +469,7 @@ class Virtualizable extends Overridable, Member, @virtualizable {
469469

470470
/**
471471
* A parameterizable declaration. Either a callable (`Callable`), a delegate
472-
* type (`DelegateType`), an indexer (`Indexer`) or an extension block (`ExtensionType`).
472+
* type (`DelegateType`), an indexer (`Indexer`), or an extension (`ExtensionType`).
473473
*/
474474
class Parameterizable extends Declaration, @parameterizable {
475475
/** Gets raw parameter `i`, including the `this` parameter at index 0. */

csharp/ql/lib/semmle/code/csharp/Property.qll

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -262,11 +262,12 @@ class Property extends DeclarationWithGetSetAccessors, @property {
262262

263263
/**
264264
* An extension property, for example `FirstChar` in
265+
*
265266
* ```csharp
266267
* static class MyExtensions {
267-
* extension(string s) {
268-
* public char FirstChar { get { ... } }
269-
* }
268+
* extension(string s) {
269+
* public char FirstChar { get { ... } }
270+
* }
270271
* }
271272
* ```
272273
*/
@@ -428,13 +429,14 @@ class Accessor extends Callable, Modifiable, Attributable, Overridable, @callabl
428429
}
429430

430431
/**
431-
* An extension accessor. Either a getter (`Getter`), a setter (`Setter`) of an
432+
* An extension accessor. Either a getter (`Getter`) or a setter (`Setter`) of an
432433
* extension property, for example `get` in
434+
*
433435
* ```csharp
434436
* static class MyExtensions {
435-
* extension(string s) {
436-
* public char FirstChar { get { ... } }
437-
* }
437+
* extension(string s) {
438+
* public char FirstChar { get { ... } }
439+
* }
438440
* }
439441
* ```
440442
*/

csharp/ql/lib/semmle/code/csharp/Type.qll

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1329,10 +1329,11 @@ class TypeMention extends @type_mention {
13291329
}
13301330

13311331
/**
1332-
* A type extension declaration, for example `extensions(string s) { ... }` in
1332+
* A type extension declaration, for example `extension(string s) { ... }` in
1333+
*
13331334
* ```csharp
13341335
* static class MyExtensions {
1335-
* extensions(string s) { ... }
1336+
* extension(string s) { ... }
13361337
* ```
13371338
*/
13381339
class ExtensionType extends Parameterizable, @extension_type {

csharp/ql/lib/semmle/code/csharp/exprs/Access.qll

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -235,10 +235,10 @@ class ParameterAccess extends LocalScopeVariableAccess, @parameter_access_expr {
235235
* }
236236
* ```
237237
*/
238-
class SyntheticParameterAccess extends ParameterAccess {
238+
class SyntheticExtensionParameter extends ParameterAccess {
239239
private Parameter p;
240240

241-
SyntheticParameterAccess() {
241+
SyntheticExtensionParameter() {
242242
exists(ExtensionType et |
243243
p = et.getReceiverParameter() and
244244
expr_access(this, p)
@@ -253,10 +253,10 @@ class SyntheticParameterAccess extends ParameterAccess {
253253
}
254254

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

259-
override string getAPrimaryQlClass() { result = "SyntheticParameterAccess" }
259+
override string getAPrimaryQlClass() { result = "SyntheticExtensionParameter" }
260260
}
261261

262262
/**

csharp/ql/lib/semmle/code/csharp/exprs/Call.qll

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,7 @@ class MethodCall extends Call, QualifiableExpr, LateBindableExpr, @method_invoca
271271
* Gets the accessor that was used to generate this method, if any. For example, the
272272
* method call `MyExtensions.get_FirstChar(s)` on line 9 is generated from the property
273273
* accessor `get_FirstChar` on line 3 in
274+
*
274275
* ```csharp
275276
* static class MyExtensions {
276277
* extension(string s) {
@@ -505,6 +506,7 @@ class OperatorCall extends Call, LateBindableExpr, @operator_invocation_expr {
505506
/**
506507
* A call to an extension operator, for example `3 * s` on
507508
* line 9 in
509+
*
508510
* ```csharp
509511
* static class MyExtensions {
510512
* extension(string s) {
@@ -623,7 +625,7 @@ class FunctionPointerCall extends DelegateLikeCall, @function_pointer_invocation
623625

624626
/**
625627
* A call to an accessor. Either a property accessor call (`PropertyCall`),
626-
* an indexer accessor call (`IndexerCall`) or an event accessor call
628+
* an indexer accessor call (`IndexerCall`), or an event accessor call
627629
* (`EventCall`).
628630
*/
629631
class AccessorCall extends Call, QualifiableExpr, @call_access_expr {
@@ -707,6 +709,7 @@ class IndexerCall extends AccessorCall, IndexerAccessExpr {
707709
/**
708710
* A call to an extension property accessor (via the property), for example
709711
* `s.FirstChar` on line 9 in
712+
*
710713
* ```csharp
711714
* static class MyExtensions {
712715
* extension(string s) {

0 commit comments

Comments
 (0)