Skip to content

Allow overriding C# method modifiers #681

Closed
@jonpryor

Description

@jonpryor

A C# method modifier are the keywords which can be applied to a method, such as visibility (public, private, …).

Some of these modifiers can be overridden via metadata, e.g. setting //method/@visibility will be inserted as-is into the C# binding.

What is desired is a way to override the default logic for emitting virtual & override.

Sometimes when binding a library, the default logic causes virtual to be emitted when override is needed for the code to compile. (TODO: Insert concrete example here.)

The current workaround is to use metadata to rename the "offending" method and then use a partial class to properly override the method.

What we would like is e.g. a managedOverride attribute in metadata/on //method.

Question: what should the semantics be? Would a "boolean" attribute be desirable, or a string?

<!-- boolean? -->
<attr path="//method[@name='example']" name="managedOverride">true</attr>

<!-- string? -->
<attr path="//method[@name='example']" name="managedOverride">override</attr>

Metadata

Metadata

Assignees

Labels

enhancementProposed change to current functionalitygeneratorIssues binding a Java library (generator, class-parse, etc.)

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions