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

Skip to content

Commit 1b6cb34

Browse files
committed
C#: Report IndexerProperty as Property in the PrintAST query
1 parent aa35fca commit 1b6cb34

9 files changed

Lines changed: 23 additions & 25 deletions

File tree

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -566,6 +566,4 @@ class IndexerProperty extends Property {
566566
// ```
567567
result.getIndexer() = i
568568
}
569-
570-
override string getAPrimaryQlClass() { result = "IndexerProperty" }
571569
}

csharp/ql/test/library-tests/arguments/PrintAst.expected

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ arguments.cs:
240240
# 72| 0: [TypeMention] Attribute
241241
# 74| 4: [Field] x
242242
# 74| -1: [TypeMention] int
243-
# 75| 5: [IndexerProperty] y
243+
# 75| 5: [Property] y
244244
# 75| -1: [TypeMention] string
245245
# 75| 3: [Getter] get_y
246246
# 75| 4: [Setter] set_y

csharp/ql/test/library-tests/attributes/PrintAst.expected

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ attributes.cs:
150150
# 62| 0: [TypeMention] Attribute
151151
# 64| 4: [Field] x
152152
# 64| -1: [TypeMention] int
153-
# 65| 5: [IndexerProperty] y
153+
# 65| 5: [Property] y
154154
# 65| -1: [TypeMention] string
155155
# 65| 3: [Getter] get_y
156156
# 65| 4: [Setter] set_y

csharp/ql/test/library-tests/csharp6/PrintAst.expected

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ csharp6.cs:
141141
# 57| -1: [TypeMention] Dictionary<Int32, String>
142142
# 57| 1: [TypeMention] int
143143
# 57| 2: [TypeMention] string
144-
# 58| 6: [IndexerProperty] DictionaryProperty
144+
# 58| 6: [Property] DictionaryProperty
145145
# 58| -1: [TypeMention] Dictionary<Int32, String>
146146
# 58| 1: [TypeMention] int
147147
# 58| 2: [TypeMention] string

csharp/ql/test/library-tests/csharp8/PrintAst.expected

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -74,10 +74,10 @@ AsyncStreams.cs:
7474
# 42| 1: [TypeMention] bool
7575
DefaultInterfaceMethods.cs:
7676
# 3| [Interface] IPerson
77-
# 5| 4: [IndexerProperty] Name
77+
# 5| 4: [Property] Name
7878
# 5| -1: [TypeMention] string
7979
# 5| 3: [Getter] get_Name
80-
# 7| 5: [IndexerProperty] Greeting
80+
# 7| 5: [Property] Greeting
8181
# 7| -1: [TypeMention] string
8282
# 9| 3: [Getter] get_Greeting
8383
# 9| 4: [StringLiteral] "Hello"
@@ -95,7 +95,7 @@ DefaultInterfaceMethods.cs:
9595
# 13| 0: [PropertyCall] access to property Greeting
9696
# 13| 1: [StringLiteral] " "
9797
# 13| 1: [ParameterAccess] access to parameter name
98-
# 15| 7: [IndexerProperty] GreetingString
98+
# 15| 7: [Property] GreetingString
9999
# 15| -1: [TypeMention] string
100100
# 15| 3: [Getter] get_GreetingString
101101
# 15| 4: [MethodCall] call to method Greet
@@ -105,11 +105,11 @@ DefaultInterfaceMethods.cs:
105105
# 20| [Class] Person
106106
#-----| 3: (Base types)
107107
# 20| 1: [TypeMention] IPerson
108-
# 22| 5: [IndexerProperty] Name
108+
# 22| 5: [Property] Name
109109
# 22| -1: [TypeMention] string
110110
# 22| 3: [Getter] get_Name
111111
# 22| 4: [StringLiteral] "Petra"
112-
# 24| 6: [IndexerProperty] Greeting
112+
# 24| 6: [Property] Greeting
113113
# 24| -1: [TypeMention] IPerson
114114
# 24| -1: [TypeMention] string
115115
# 24| 3: [Getter] get_Greeting
@@ -141,11 +141,11 @@ NullableRefTypes.cs:
141141
# 9| -1: [TypeMention] MyClass
142142
# 10| 6: [Field] B
143143
# 10| -1: [TypeMention] MyClass
144-
# 13| 7: [IndexerProperty] C
144+
# 13| 7: [Property] C
145145
# 13| -1: [TypeMention] MyClass
146146
# 13| 3: [Getter] get_C
147147
# 13| 4: [NullLiteral] null
148-
# 14| 8: [IndexerProperty] D
148+
# 14| 8: [Property] D
149149
# 14| -1: [TypeMention] MyClass
150150
# 14| 3: [Getter] get_D
151151
# 14| 4: [ThisAccess] this access
@@ -417,7 +417,7 @@ NullableRefTypes.cs:
417417
# 110| 0: [NullLiteral] null
418418
# 112| 12: [Field] Property
419419
# 112| -1: [TypeMention] MyClass
420-
# 113| 13: [IndexerProperty] RefProperty
420+
# 113| 13: [Property] RefProperty
421421
# 113| -1: [TypeMention] MyClass
422422
# 113| 3: [Getter] get_RefProperty
423423
# 113| 4: [RefExpr] ref ...
@@ -502,7 +502,7 @@ NullableRefTypes.cs:
502502
# 154| [Class] DisabledNullability
503503
# 156| 5: [Field] f1
504504
# 156| -1: [TypeMention] MyClass
505-
# 157| 6: [IndexerProperty] P
505+
# 157| 6: [Property] P
506506
# 157| -1: [TypeMention] MyClass
507507
# 157| 3: [Getter] get_P
508508
# 157| 4: [ObjectCreation] object creation of type MyClass

csharp/ql/test/library-tests/expressions/PrintAst.expected

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -599,7 +599,7 @@ expressions.cs:
599599
# 64| 0: [PropertyCall] access to property Length
600600
# 64| -1: [ParameterAccess] access to parameter s
601601
# 64| 1: [ParameterAccess] access to parameter x
602-
# 67| 14: [IndexerProperty] Name
602+
# 67| 14: [Property] Name
603603
# 67| -1: [TypeMention] string
604604
# 69| 3: [Getter] get_Name
605605
# 69| 4: [BlockStmt] {...}
@@ -1504,7 +1504,7 @@ expressions.cs:
15041504
# 375| 1: [ObjectCreation] object creation of type List<String>
15051505
# 375| 0: [TypeMention] List<String>
15061506
# 375| 1: [TypeMention] string
1507-
# 377| 7: [IndexerProperty] Name
1507+
# 377| 7: [Property] Name
15081508
# 377| -1: [TypeMention] string
15091509
# 377| 3: [Getter] get_Name
15101510
# 377| 4: [BlockStmt] {...}
@@ -1518,7 +1518,7 @@ expressions.cs:
15181518
# 377| 0: [AssignExpr] ... = ...
15191519
# 377| 0: [FieldAccess] access to field name
15201520
# 377| 1: [ParameterAccess] access to parameter value
1521-
# 378| 8: [IndexerProperty] PhoneNumbers
1521+
# 378| 8: [Property] PhoneNumbers
15221522
# 378| -1: [TypeMention] List<String>
15231523
# 378| 1: [TypeMention] string
15241524
# 378| 3: [Getter] get_PhoneNumbers

csharp/ql/test/library-tests/generics/PrintAst.expected

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ generics.cs:
289289
# 33| 9: [Method] staticFoo
290290
# 33| -1: [TypeMention] Void
291291
# 33| 4: [BlockStmt] {...}
292-
# 35| 10: [IndexerProperty] Name
292+
# 35| 10: [Property] Name
293293
# 35| -1: [TypeMention] string
294294
# 35| 3: [Getter] get_Name
295295
# 35| 4: [BlockStmt] {...}

csharp/ql/test/library-tests/members/PrintAst.expected

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ Members.cs:
3434
# 14| 4: [BlockStmt] {...}
3535
# 16| 7: [Field] Field
3636
# 16| -1: [TypeMention] string
37-
# 18| 8: [IndexerProperty] Prop
37+
# 18| 8: [Property] Prop
3838
# 18| -1: [TypeMention] string
3939
# 18| 3: [Getter] get_Prop
4040
# 18| 4: [Setter] set_Prop
@@ -68,7 +68,7 @@ Members.cs:
6868
# 26| 4: [BlockStmt] {...}
6969
# 28| 8: [Field] Field
7070
# 28| -1: [TypeMention] string
71-
# 30| 9: [IndexerProperty] Prop
71+
# 30| 9: [Property] Prop
7272
# 30| -1: [TypeMention] string
7373
# 30| 3: [Getter] get_Prop
7474
# 30| 4: [Setter] set_Prop
@@ -110,7 +110,7 @@ Members.cs:
110110
# 40| 4: [BlockStmt] {...}
111111
# 41| 7: [Field] Field
112112
# 41| -1: [TypeMention] string
113-
# 42| 8: [IndexerProperty] Prop
113+
# 42| 8: [Property] Prop
114114
# 42| -1: [TypeMention] string
115115
# 42| 3: [Getter] get_Prop
116116
# 42| 4: [Setter] set_Prop
@@ -144,7 +144,7 @@ Members.cs:
144144
# 47| 4: [BlockStmt] {...}
145145
# 48| 8: [Field] Field
146146
# 48| -1: [TypeMention] string
147-
# 49| 9: [IndexerProperty] Prop
147+
# 49| 9: [Property] Prop
148148
# 49| -1: [TypeMention] string
149149
# 49| 3: [Getter] get_Prop
150150
# 49| 4: [Setter] set_Prop
@@ -173,7 +173,7 @@ Members.cs:
173173
#-----| 2: (Parameters)
174174
# 57| 0: [Parameter] i
175175
# 57| 1: [Parameter] value
176-
# 58| 6: [IndexerProperty] Prop
176+
# 58| 6: [Property] Prop
177177
# 58| -1: [TypeMention] string
178178
# 58| 3: [Getter] get_Prop
179179
# 58| 4: [Setter] set_Prop
@@ -202,7 +202,7 @@ Members.cs:
202202
#-----| 2: (Parameters)
203203
# 65| 0: [Parameter] i
204204
# 65| 1: [Parameter] value
205-
# 66| 6: [IndexerProperty] Prop
205+
# 66| 6: [Property] Prop
206206
# 66| -1: [TypeMention] string
207207
# 66| 3: [Getter] get_Prop
208208
# 66| 4: [Setter] set_Prop

csharp/ql/test/library-tests/properties/PrintAst.expected

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ properties.cs:
33
# 7| 1: [Class] Button
44
# 10| 5: [Field] caption
55
# 10| -1: [TypeMention] string
6-
# 12| 6: [IndexerProperty] Caption
6+
# 12| 6: [Property] Caption
77
# 12| -1: [TypeMention] string
88
# 15| 3: [Getter] get_Caption
99
# 15| 4: [BlockStmt] {...}

0 commit comments

Comments
 (0)