mirror of
https://github.com/github/codeql.git
synced 2026-05-02 04:05:14 +02:00
C#: Add tests for named attribute arguments
This commit is contained in:
@@ -61,4 +61,17 @@ class ArgumentsTest
|
||||
var tuple = (13, 14);
|
||||
(Prop, this[15, 16]) = tuple;
|
||||
}
|
||||
|
||||
[MyAttribute(false)]
|
||||
void f6() { }
|
||||
|
||||
[MyAttribute(true, y = "", x = 0)]
|
||||
void f7() { }
|
||||
}
|
||||
|
||||
class MyAttribute : Attribute
|
||||
{
|
||||
public int x;
|
||||
public string y { get; set; }
|
||||
public MyAttribute(bool b) { }
|
||||
}
|
||||
|
||||
@@ -12,3 +12,7 @@
|
||||
| attributes.cs:38:12:38:30 | [AssemblyFileVersion(...)] | 0 | attributes.cs:38:32:38:40 | "1.0.0.0" |
|
||||
| attributes.cs:40:2:40:22 | [AttributeUsage(...)] | 0 | attributes.cs:40:24:40:50 | access to constant All |
|
||||
| attributes.cs:43:6:43:16 | [Conditional(...)] | 0 | attributes.cs:43:18:43:25 | "DEBUG2" |
|
||||
| attributes.cs:51:6:51:16 | [My(...)] | 0 | attributes.cs:51:18:51:22 | false |
|
||||
| attributes.cs:54:6:54:16 | [My(...)] | 0 | attributes.cs:54:18:54:21 | true |
|
||||
| attributes.cs:54:6:54:16 | [My(...)] | 1 | attributes.cs:54:28:54:29 | "" |
|
||||
| attributes.cs:54:6:54:16 | [My(...)] | 2 | attributes.cs:54:36:54:36 | 0 |
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
| attributes.cs:41:7:41:9 | Foo | attributes.cs:40:2:40:22 | [AttributeUsage(...)] | System.AttributeUsageAttribute |
|
||||
| attributes.cs:44:17:44:19 | foo | attributes.cs:43:6:43:16 | [Conditional(...)] | System.Diagnostics.ConditionalAttribute |
|
||||
| attributes.cs:49:23:49:23 | x | attributes.cs:49:14:49:16 | [Foo(...)] | Foo |
|
||||
| attributes.cs:52:10:52:11 | M1 | attributes.cs:51:6:51:16 | [My(...)] | MyAttribute |
|
||||
| attributes.cs:55:10:55:11 | M2 | attributes.cs:54:6:54:16 | [My(...)] | MyAttribute |
|
||||
| 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 |
|
||||
|
||||
@@ -47,4 +47,17 @@ class Foo : Attribute
|
||||
class Bar
|
||||
{
|
||||
int inc([Foo] int x) { return x + 1; }
|
||||
|
||||
[MyAttribute(false)]
|
||||
void M1() { }
|
||||
|
||||
[MyAttribute(true, y = "", x = 0)]
|
||||
void M2() { }
|
||||
}
|
||||
|
||||
class MyAttribute : Attribute
|
||||
{
|
||||
public int x;
|
||||
public string y { get; set; }
|
||||
public MyAttribute(bool b) { }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user