-
Notifications
You must be signed in to change notification settings - Fork 1
Conversation
/// <summary> | ||
/// Specifies how .NET types are marshalled to and from JavaScript values. | ||
/// </summary> | ||
[AttributeUsage( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Later, if and when we support marshalling fields.
Fields are not supported now, but there's no reason they can't be marshalled in almost the same way as properties, along with an optimization for const
fields. I don't think it's a priority now though.
/// where the type argument matches the type being of the property, parameter, or | ||
/// return value the <see cref="JSMarshalAsAttribute" /> is applied to. | ||
/// </summary> | ||
public Type? CustomMarshalType { get; init; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought about that, but we'd still need a non-generic JSMarshalAsAttribute
to support uses that don't specify a custom marshaller type. So I didn't think it was worth creating another attribute.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm abandoning this PR because it's not a top priority at the moment, and was mainly meant as a starting point for discussion. I do still plan to implement this idea eventually. Since opening this PR I've done a lot more work related to marshalling, so I think there can be some improvements to this design when I bring it back. |
This is a proposal for a custom marshalling attribute and interface. Custom marshalling is not actually implemented yet in the code-generator. The design is mostly modeled after System.Runtime.InteropServices.MarshalAsAttribute.