-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Open
Labels
Implemented Needs ECMA SpecThis feature has been implemented in C#, but still needs to be merged into the ECMA specificationThis feature has been implemented in C#, but still needs to be merged into the ECMA specificationProposalProposal championSmallish Feature
Milestone
Description
- Proposal added
- Discussed in LDM
- Decision in LDM
- Finalized (done, rejected, inactive)
- Spec'ed
The Roslyn compilers have the machinery to rewrite expressions so that they occur in non-nested contexts if necessary. We use that mechanism as part of the translation of await. We could use it to easily permit stackalloc in contexts where they are not simply the initializer of a local declaration.
The specification would be something like:
Stack allocation
We modify the section Stack allocation of the C# language specification to relax the places when a stackalloc expression may appear. We delete
local_variable_initializer_unsafe
: stackalloc_initializer
;
stackalloc_initializer
: 'stackalloc' unmanaged_type '[' expression ']'
;and replace them with one production in which the left-hand-side is primary_no_array_creation_expression and the right-hand-side is the stackalloc expression.
primary_no_array_creation_expression
: 'stackalloc' unmanaged_type '[' expression ']'
;Other changes to the stackalloc expression that occurred in C# 7.3 should be reflected as well.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Implemented Needs ECMA SpecThis feature has been implemented in C#, but still needs to be merged into the ECMA specificationThis feature has been implemented in C#, but still needs to be merged into the ECMA specificationProposalProposal championSmallish Feature