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)
186186 }
187187 break ;
188188 case TypedConstantKind . Enum :
189- stubWriter . Write ( "throw null" ) ;
189+ stubWriter . Write ( $ "({ c . Type ! . GetQualifiedName ( ) } ) ") ;
190+ stubWriter . Write ( c . Value ! . ToString ( ) ) ;
190191 break ;
191192 case TypedConstantKind . Array :
192193 stubWriter . Write ( "new []{" ) ;
@@ -200,7 +201,8 @@ private void StubTypedConstant(TypedConstant c)
200201 }
201202
202203 private static readonly HashSet < string > attributeAllowList = new ( ) {
203- "System.FlagsAttribute"
204+ "System.FlagsAttribute" ,
205+ "System.AttributeUsageAttribute"
204206 } ;
205207
206208 private void StubAttribute ( AttributeData a , string prefix )
@@ -219,6 +221,14 @@ private void StubAttribute(AttributeData a, string prefix)
219221 {
220222 stubWriter . Write ( "(" ) ;
221223 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+ } ) ;
222232 stubWriter . Write ( ")" ) ;
223233 }
224234 stubWriter . WriteLine ( "]" ) ;
You can’t perform that action at this time.
0 commit comments