Skip to content

Commit c95dd33

Browse files
authored
Change classMemberDeclaration to memberDeclaration
The grammar in the language specification used to have a non-terminal `<classMemberDeclaration>`, and the spec parser had special variants like `<mixinMemberDeclaration>` and `<extensionTypeMemberDeclaration>`. This would be useful if different membered declarations have different syntax, and that was once the plan. However, we never actually got around to make this kind of distinction, and it's a more useful approach to report disallowed kinds of member declarations using ad-hoc compile-time checks (which is also what the implementations do already). This PR changes all references to these non-terminals to the plain name `<memberDeclaration>` and adjusts the accompanying explanations accordingly.
1 parent 0f472af commit c95dd33

File tree

1 file changed

+14
-7
lines changed

1 file changed

+14
-7
lines changed

specification/dartLangSpec.tex

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,11 @@
4141
% version of the language which will actually be specified by the next stable
4242
% release of this document.
4343
%
44+
% Oct 2025
45+
% - Simplify the member declaration grammar by using a single `memberDeclaration`
46+
% to derive all kinds of member declarations (for a class, a mixin, etc),
47+
% rather than having a dedicated `classMemberDeclaration`.
48+
%
4449
% Sep 2025
4550
% - Remove the rules about DartDoc comments. This topic is now handled by each
4651
% of the tools that process those comments in any way.
@@ -2831,12 +2836,12 @@ \section{Classes}
28312836
<classDeclaration> ::=
28322837
\ABSTRACT? \CLASS{} <typeIdentifier> <typeParameters>?
28332838
\gnewline{} <superclass>? <interfaces>?
2834-
\gnewline{} `{' (<metadata> <classMemberDeclaration>)* `}'
2839+
\gnewline{} `{' (<metadata> <memberDeclaration>)* `}'
28352840
\alt \ABSTRACT? \CLASS{} <mixinApplicationClass>
28362841

28372842
<typeNotVoidList> ::= <typeNotVoid> (`,' <typeNotVoid>)*
28382843

2839-
<classMemberDeclaration> ::= <declaration> `;'
2844+
<memberDeclaration> ::= <declaration> `;'
28402845
\alt <methodSignature> <functionBody>
28412846

28422847
<methodSignature> ::= <constructorSignature> <initializers>?
@@ -2879,6 +2884,8 @@ \section{Classes}
28792884

28802885
\LMHash{}%
28812886
A class has constructors, instance members and static members.
2887+
The members are declared by
2888+
\IndexCustom{member declarations}{member declaration}.
28822889
The \IndexCustom{instance members}{members!instance} of a class
28832890
are its instance methods, getters, setters and instance variables.
28842891
The \IndexCustom{static members}{members!static} of a class
@@ -5963,7 +5970,7 @@ \subsection{Mixin Declaration}
59635970

59645971
\LMHash{}%
59655972
A mixin defines zero or more
5966-
\IndexCustom{mixin member declarations}{mixin!member declaration},
5973+
\IndexCustom{member declarations}{member declaration},
59675974
zero or more
59685975
\IndexCustom{required superinterfaces}{mixin!required superinterface},
59695976
one
@@ -5994,7 +6001,7 @@ \subsection{Mixin Declaration}
59946001
\begin{grammar}
59956002
<mixinDeclaration> ::= \MIXIN{} <typeIdentifier> <typeParameters>?
59966003
\gnewline{} (\ON{} <typeNotVoidList>)? <interfaces>?
5997-
\gnewline{} `\{' (<metadata> <classMemberDeclaration>)* `\}'
6004+
\gnewline{} `\{' (<metadata> <memberDeclaration>)* `\}'
59986005
\end{grammar}
59996006

60006007
\LMHash{}%
@@ -6081,7 +6088,7 @@ \subsection{Mixin Declaration}
60816088
with the \NoIndex{required superinterface}s $T_1$, \ldots, $T_n$,
60826089
the \NoIndex{combined superinterface} $M_S$,
60836090
\NoIndex{implemented interface}s $I_1$, \ldots, $I_k$
6084-
and the instance members declared in $M$ as \Index{mixin member declarations}.
6091+
and the instance members declared in $M$ as \Index{member declarations}.
60856092

60866093

60876094
\subsection{Mixin Application}
@@ -6095,7 +6102,7 @@ \subsection{Mixin Application}
60956102
$M$ be a mixin with \NoIndex{required superinterface}s $T_1$, \ldots, $T_n$,
60966103
\NoIndex{combined superinterface} $M_S$,
60976104
\NoIndex{implemented interfaces} $I_1$, \ldots, $I_k$ and
6098-
\metavar{members} as \NoIndex{mixin member declarations},
6105+
\metavar{members} as \NoIndex{member declarations},
60996106
and let $N$ be a name.
61006107

61016108
\LMHash{}%
@@ -6224,7 +6231,7 @@ \section{Extensions}
62246231
\begin{grammar}
62256232
<extensionDeclaration> ::= \gnewline{}
62266233
\EXTENSION{} <typeIdentifierNotType>? <typeParameters>? \ON{} <type>
6227-
\gnewline{} `\{' (<metadata> <classMemberDeclaration>)* `\}'
6234+
\gnewline{} `\{' (<metadata> <memberDeclaration>)* `\}'
62286235
\end{grammar}
62296236

62306237
\LMHash{}%

0 commit comments

Comments
 (0)