-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Provide locations for src-gen diagnostic output #61430
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,6 +5,7 @@ | |
| using System.Diagnostics; | ||
| using System.Linq; | ||
| using System.Reflection; | ||
| using Microsoft.CodeAnalysis; | ||
|
|
||
| namespace System.Text.Json.Reflection | ||
| { | ||
|
|
@@ -45,5 +46,26 @@ private static bool HasJsonConstructorAttribute(ConstructorInfo constructorInfo) | |
|
|
||
| return false; | ||
| } | ||
|
|
||
| public static Location? GetDiagnosticLocation(this Type type) | ||
| { | ||
| TypeWrapper? typeWrapper = type as TypeWrapper; | ||
layomia marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| Debug.Assert(typeWrapper != null); | ||
| return typeWrapper.Location; | ||
| } | ||
|
|
||
| public static Location? GetDiagnosticLocation(this PropertyInfo propertyInfo) | ||
| { | ||
| PropertyInfoWrapper? propertyInfoWrapper = propertyInfo as PropertyInfoWrapper; | ||
| Debug.Assert(propertyInfoWrapper != null); | ||
|
||
| return propertyInfoWrapper.Location; | ||
| } | ||
|
|
||
| public static Location? GetDiagnosticLocation(this FieldInfo fieldInfo) | ||
| { | ||
| FieldInfoWrapper? fieldInfoWrapper = fieldInfo as FieldInfoWrapper; | ||
| Debug.Assert(fieldInfoWrapper != null); | ||
| return fieldInfoWrapper.Location; | ||
| } | ||
| } | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.