Skip to content

Use synthesized wrapper methods for compiler-generated 'throw's #59601

@RikkiGibson

Description

@RikkiGibson

Perhaps we should do similar to what we did for !! and do the throw via a synthesized wrapper method. Would it be necessary to change the language of the patterns proposal before changing the implementation to use such a helper? Intuitively it seems like no.

...
If there is no such switch_expression_arm, the switch_expression throws an instance of the exception System.Runtime.CompilerServices.SwitchExpressionException.

Originally posted by @RikkiGibson in #59449 (comment)


The benefit of this change is that compiled switch expressions are easier to inline when they use a helper method instead of directly using the 'throw' instruction.

Metadata

Metadata

Assignees

Labels

Area-CompilersCode Gen QualityRoom for improvement in the quality of the compiler's generated code

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions