mirror of
https://github.com/github/codeql.git
synced 2026-02-23 10:23:41 +01:00
C#: Add property test case where the field keyword is used.
This commit is contained in:
@@ -230,3 +230,19 @@ properties.cs:
|
||||
#-----| 2: (Parameters)
|
||||
# 124| 0: [Parameter] value
|
||||
# 124| 4: [BlockStmt] {...}
|
||||
# 128| 10: [Class] UseFieldKeyword
|
||||
# 130| 6: [Property] Prop
|
||||
# 130| -1: [TypeMention] object
|
||||
# 132| 3: [Getter] get_Prop
|
||||
# 132| 4: [BlockStmt] {...}
|
||||
# 132| 0: [ReturnStmt] return ...;
|
||||
# 132| 0: [FieldAccess] access to field Prop.field
|
||||
# 133| 4: [Setter] set_Prop
|
||||
#-----| 2: (Parameters)
|
||||
# 133| 0: [Parameter] value
|
||||
# 133| 4: [BlockStmt] {...}
|
||||
# 133| 0: [ExprStmt] ...;
|
||||
# 133| 0: [AssignExpr] ... = ...
|
||||
# 133| 0: [FieldAccess] access to field Prop.field
|
||||
# 133| 1: [ParameterAccess] access to parameter value
|
||||
# 130| 7: [Field] Prop.field
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
| Prop.field |
|
||||
| caption |
|
||||
| next |
|
||||
| y |
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* @name Test that there are no backing fields
|
||||
* @name Test that there are no backing fields except for properties that use the `field` keyword in their getter or setter.
|
||||
*/
|
||||
|
||||
import csharp
|
||||
|
||||
@@ -124,4 +124,13 @@ namespace Properties
|
||||
set { }
|
||||
}
|
||||
}
|
||||
|
||||
class UseFieldKeyword
|
||||
{
|
||||
public object Prop
|
||||
{
|
||||
get { return field; }
|
||||
set { field = value; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user