Enable various variables and factories with no implementation #4106
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
With support for augmentation, variables can be declared with no initializing expression in a couple of new cases where this was previously a syntax error, namely constant and final top-level variables as well as constant and final static variables. This PR changes the grammar to allow this kind of declaration. The point is that the omitted initializing expression can be provided by augmentation. Similarly for factory constructor declarations, they do not have to have a body when the body can be provided by augmentation. Finally, static getters, setters, and methods are also generalized to allow omitting the body, that is, they are allowed to look like "abstract static members", again because the body can be provided by augmentation.
The set of elements that are required for each definition are unchanged, but parsing will now succeed, and it is a non-syntax compile-time error if an element is omitted, e.g., if a constant top-level variable has no initializing expression.