C#: Add more attribute testcases.

This commit is contained in:
Michael Nebel
2022-02-01 13:49:48 +01:00
parent 31a70a17a4
commit 2c6e35f55e
4 changed files with 142 additions and 1 deletions

View File

@@ -80,6 +80,16 @@ arguments
| attributes.cs:97:10:97:21 | [My3(...)] | 0 | attributes.cs:97:23:97:23 | 2 |
| attributes.cs:100:10:100:21 | [My3(...)] | 0 | attributes.cs:100:23:100:23 | 3 |
| attributes.cs:101:8:101:19 | [My3(...)] | 0 | attributes.cs:101:21:101:21 | 4 |
| attributes.cs:106:6:106:17 | [My3(...)] | 0 | attributes.cs:106:19:106:19 | 5 |
| attributes.cs:107:14:107:25 | [My3(...)] | 0 | attributes.cs:107:27:107:27 | 6 |
| attributes.cs:112:10:112:21 | [My3(...)] | 0 | attributes.cs:112:23:112:23 | 7 |
| attributes.cs:113:18:113:29 | [My3(...)] | 0 | attributes.cs:113:31:113:31 | 8 |
| attributes.cs:116:18:116:29 | [My3(...)] | 0 | attributes.cs:116:31:116:31 | 9 |
| attributes.cs:117:17:117:28 | [My3(...)] | 0 | attributes.cs:117:30:117:31 | 10 |
| attributes.cs:124:18:124:29 | [My3(...)] | 0 | attributes.cs:124:31:124:32 | 11 |
| attributes.cs:125:18:125:29 | [My3(...)] | 0 | attributes.cs:125:31:125:32 | 12 |
| attributes.cs:128:10:128:21 | [My3(...)] | 0 | attributes.cs:128:23:128:24 | 13 |
| attributes.cs:129:17:129:28 | [My3(...)] | 0 | attributes.cs:129:30:129:31 | 14 |
constructorArguments
| Assembly1.dll:0:0:0:0 | [Custom(...)] | 0 | Assembly1.dll:0:0:0:0 | 1 |
| Assembly1.dll:0:0:0:0 | [Custom(...)] | 0 | Assembly1.dll:0:0:0:0 | 3 |
@@ -150,6 +160,16 @@ constructorArguments
| attributes.cs:97:10:97:21 | [My3(...)] | 0 | attributes.cs:97:23:97:23 | 2 |
| attributes.cs:100:10:100:21 | [My3(...)] | 0 | attributes.cs:100:23:100:23 | 3 |
| attributes.cs:101:8:101:19 | [My3(...)] | 0 | attributes.cs:101:21:101:21 | 4 |
| attributes.cs:106:6:106:17 | [My3(...)] | 0 | attributes.cs:106:19:106:19 | 5 |
| attributes.cs:107:14:107:25 | [My3(...)] | 0 | attributes.cs:107:27:107:27 | 6 |
| attributes.cs:112:10:112:21 | [My3(...)] | 0 | attributes.cs:112:23:112:23 | 7 |
| attributes.cs:113:18:113:29 | [My3(...)] | 0 | attributes.cs:113:31:113:31 | 8 |
| attributes.cs:116:18:116:29 | [My3(...)] | 0 | attributes.cs:116:31:116:31 | 9 |
| attributes.cs:117:17:117:28 | [My3(...)] | 0 | attributes.cs:117:30:117:31 | 10 |
| attributes.cs:124:18:124:29 | [My3(...)] | 0 | attributes.cs:124:31:124:32 | 11 |
| attributes.cs:125:18:125:29 | [My3(...)] | 0 | attributes.cs:125:31:125:32 | 12 |
| attributes.cs:128:10:128:21 | [My3(...)] | 0 | attributes.cs:128:23:128:24 | 13 |
| attributes.cs:129:17:129:28 | [My3(...)] | 0 | attributes.cs:129:30:129:31 | 14 |
namedArguments
| Assembly1.dll:0:0:0:0 | [Custom(...)] | Prop2 | Assembly1.dll:0:0:0:0 | array creation of type Object[] |
| Assembly1.dll:0:0:0:0 | [Custom(...)] | Prop2 | Assembly1.dll:0:0:0:0 | array creation of type Object[] |

View File

@@ -22,6 +22,16 @@
| attributes.cs:98:14:98:24 | My1Delegate | attributes.cs:96:2:96:13 | [My3(...)] | My3Attribute |
| attributes.cs:102:17:102:27 | Invoke | attributes.cs:100:10:100:21 | [My3(...)] | My3Attribute |
| attributes.cs:102:17:102:27 | My2Delegate | attributes.cs:101:8:101:19 | [My3(...)] | My3Attribute |
| attributes.cs:108:32:108:32 | + | attributes.cs:106:6:106:17 | [My3(...)] | My3Attribute |
| attributes.cs:108:32:108:32 | + | attributes.cs:107:14:107:25 | [My3(...)] | My3Attribute |
| attributes.cs:114:9:114:11 | get_Item | attributes.cs:112:10:112:21 | [My3(...)] | My3Attribute |
| attributes.cs:114:9:114:11 | get_Item | attributes.cs:113:18:113:29 | [My3(...)] | My3Attribute |
| attributes.cs:118:9:118:11 | set_Item | attributes.cs:116:18:116:29 | [My3(...)] | My3Attribute |
| attributes.cs:118:9:118:11 | value | attributes.cs:117:17:117:28 | [My3(...)] | My3Attribute |
| attributes.cs:126:9:126:11 | get_Prop1 | attributes.cs:124:18:124:29 | [My3(...)] | My3Attribute |
| attributes.cs:126:9:126:11 | get_Prop1 | attributes.cs:125:18:125:29 | [My3(...)] | My3Attribute |
| attributes.cs:130:9:130:11 | set_Prop1 | attributes.cs:128:10:128:21 | [My3(...)] | My3Attribute |
| attributes.cs:130:9:130:11 | value | attributes.cs:129:17:129:28 | [My3(...)] | My3Attribute |
| attributes.dll:0:0:0:0 | attributes, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null | attributes.cs:10:12:10:24 | [AssemblyTitle(...)] | System.Reflection.AssemblyTitleAttribute |
| attributes.dll:0:0:0:0 | attributes, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null | attributes.cs:11:12:11:30 | [AssemblyDescription(...)] | System.Reflection.AssemblyDescriptionAttribute |
| attributes.dll:0:0:0:0 | attributes, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null | attributes.cs:12:12:12:32 | [AssemblyConfiguration(...)] | System.Reflection.AssemblyConfigurationAttribute |

View File

@@ -324,3 +324,84 @@ attributes.cs:
#-----| 2: (Parameters)
# 102| 0: [Parameter] message
# 102| -1: [TypeMention] string
# 104| [Class] MyAttributeUsage
# 108| 5: [AddOperator] +
# 108| -1: [TypeMention] int
#-----| 0: (Attributes)
# 106| 1: [DefaultAttribute] [My3(...)]
# 106| -1: [TypeMention] My3Attribute
# 106| 0: [IntLiteral] 5
# 107| 2: [ReturnAttribute] [My3(...)]
# 107| -1: [TypeMention] My3Attribute
# 107| 0: [IntLiteral] 6
#-----| 2: (Parameters)
# 108| 0: [Parameter] a
# 108| -1: [TypeMention] MyAttributeUsage
# 108| 1: [Parameter] b
# 108| -1: [TypeMention] MyAttributeUsage
# 108| 4: [IntLiteral] 0
# 110| 6: [Indexer] Item
# 110| -1: [TypeMention] int
#-----| 1: (Parameters)
# 110| 0: [Parameter] x
# 110| -1: [TypeMention] int
# 114| 3: [Getter] get_Item
#-----| 0: (Attributes)
# 112| 1: [DefaultAttribute] [My3(...)]
# 112| -1: [TypeMention] My3Attribute
# 112| 0: [IntLiteral] 7
# 113| 2: [ReturnAttribute] [My3(...)]
# 113| -1: [TypeMention] My3Attribute
# 113| 0: [IntLiteral] 8
#-----| 2: (Parameters)
# 110| 0: [Parameter] x
# 114| 4: [BlockStmt] {...}
# 114| 0: [ReturnStmt] return ...;
# 114| 0: [AddExpr] ... + ...
# 114| 0: [ParameterAccess] access to parameter x
# 114| 1: [IntLiteral] 1
# 118| 4: [Setter] set_Item
#-----| 0: (Attributes)
# 116| 1: [DefaultAttribute] [My3(...)]
# 116| -1: [TypeMention] My3Attribute
# 116| 0: [IntLiteral] 9
#-----| 2: (Parameters)
# 110| 0: [Parameter] x
# 118| 1: [Parameter] value
#-----| 0: (Attributes)
# 117| 1: [DefaultAttribute] [My3(...)]
# 117| -1: [TypeMention] My3Attribute
# 117| 0: [IntLiteral] 10
# 118| 4: [BlockStmt] {...}
# 118| 0: [ReturnStmt] return ...;
# 121| 7: [Field] p
# 121| -1: [TypeMention] int
# 122| 8: [Property] Prop1
# 122| -1: [TypeMention] int
# 126| 3: [Getter] get_Prop1
#-----| 0: (Attributes)
# 124| 1: [DefaultAttribute] [My3(...)]
# 124| -1: [TypeMention] My3Attribute
# 124| 0: [IntLiteral] 11
# 125| 2: [ReturnAttribute] [My3(...)]
# 125| -1: [TypeMention] My3Attribute
# 125| 0: [IntLiteral] 12
# 126| 4: [BlockStmt] {...}
# 126| 0: [ReturnStmt] return ...;
# 126| 0: [FieldAccess] access to field p
# 130| 4: [Setter] set_Prop1
#-----| 0: (Attributes)
# 128| 1: [DefaultAttribute] [My3(...)]
# 128| -1: [TypeMention] My3Attribute
# 128| 0: [IntLiteral] 13
#-----| 2: (Parameters)
# 130| 0: [Parameter] value
#-----| 0: (Attributes)
# 129| 1: [DefaultAttribute] [My3(...)]
# 129| -1: [TypeMention] My3Attribute
# 129| 0: [IntLiteral] 14
# 130| 4: [BlockStmt] {...}
# 130| 0: [ExprStmt] ...;
# 130| 0: [AssignExpr] ... = ...
# 130| 0: [FieldAccess] access to field p
# 130| 1: [ParameterAccess] access to parameter value

View File

@@ -99,4 +99,34 @@ delegate int My1Delegate(string message);
[return: My3Attribute(3)]
[type: My3Attribute(4)]
delegate string My2Delegate(string message);
delegate string My2Delegate(string message);
public class MyAttributeUsage
{
[My3Attribute(5)]
[return: My3Attribute(6)]
public static int operator +(MyAttributeUsage a, MyAttributeUsage b) => 0;
public int this[int x]
{
[My3Attribute(7)]
[return: My3Attribute(8)]
get { return x + 1; }
[method: My3Attribute(9)]
[param: My3Attribute(10)]
set { return; }
}
private int p;
public int Prop1
{
[method: My3Attribute(11)]
[return: My3Attribute(12)]
get { return p; }
[My3Attribute(13)]
[param: My3Attribute(14)]
set { p = value; }
}
}