File tree Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -186,7 +186,8 @@ private void StubTypedConstant(TypedConstant c)
186
186
}
187
187
break ;
188
188
case TypedConstantKind . Enum :
189
- stubWriter . Write ( "throw null" ) ;
189
+ stubWriter . Write ( $ "({ c . Type ! . GetQualifiedName ( ) } ) ") ;
190
+ stubWriter . Write ( c . Value ! . ToString ( ) ) ;
190
191
break ;
191
192
case TypedConstantKind . Array :
192
193
stubWriter . Write ( "new []{" ) ;
@@ -200,7 +201,8 @@ private void StubTypedConstant(TypedConstant c)
200
201
}
201
202
202
203
private static readonly HashSet < string > attributeAllowList = new ( ) {
203
- "System.FlagsAttribute"
204
+ "System.FlagsAttribute" ,
205
+ "System.AttributeUsageAttribute"
204
206
} ;
205
207
206
208
private void StubAttribute ( AttributeData a , string prefix )
@@ -219,6 +221,14 @@ private void StubAttribute(AttributeData a, string prefix)
219
221
{
220
222
stubWriter . Write ( "(" ) ;
221
223
WriteCommaSep ( a . ConstructorArguments , StubTypedConstant ) ;
224
+ if ( a . ConstructorArguments . Any ( ) && a . NamedArguments . Any ( ) )
225
+ stubWriter . Write ( "," ) ;
226
+ WriteCommaSep ( a . NamedArguments , arg =>
227
+ {
228
+ stubWriter . Write ( arg . Key ) ;
229
+ stubWriter . Write ( " = " ) ;
230
+ StubTypedConstant ( arg . Value ) ;
231
+ } ) ;
222
232
stubWriter . Write ( ")" ) ;
223
233
}
224
234
stubWriter . WriteLine ( "]" ) ;
You can’t perform that action at this time.
0 commit comments