-
Notifications
You must be signed in to change notification settings - Fork 205
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Split augmentations into improved part files and augmentation declara… #3800
Conversation
Whoops, I thought this was an issue; it's a PR. Opened #3848 so we have an issue for this. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Addressed. Will land now and use this as base for any further changes.
…tions. Unifies "augmentation libraries" and part files. Part files can have imports, exports and further part files. Part files can use configurable URIs. A `part of` directive can no longer use a library name. Part files inherit the imports of their parent file, and can extend or shadow those with their own imports. Augmentation declarations can occur in any part or library file. An augmentation must occur "below" the declaration it augments: Either later in the same file ("below" when viewing code), or in the file-tree of a part file of the same file ("below" in the part-file tree of the library). This ensures that the original declaration occurs above all augmentations of it, and that all augmentations of the same original declaration occur on a single path down the part-file tree of the library. What again ensures that reordering `part` directives does not change the order of augmentations. Changed the lexical scope of augmenting class-like declarations (declarations with a member scope) to only contain the members declared inside the same class-like declaration, not the collection of all members declared by all declarations with the same name. Rewrote the part about applying augmentations. This is more speculative since it doesn't provide a complete definition, but more of a pattern for extending semantics that assume a name refers to a single declaration, into one where a name denotes a set (stack depending on augmentation application order), of individual syntactic declarations. The existing semi-syntactic "merging" may not be a viable specification approach, since it requires merging code from different scopes into a single scope. That's not impossible, we also move code around for mixin applications, but it's also easy to get wrong.
9ed33c1
to
bf5fc86
Compare
chooses the URI that the `part` directive refers to, and after that the | ||
included file works just as any other part file. | ||
|
||
It’s a **compile-time error** if a Dart (parent) file with URI *P* has a `part` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When I read this paragraph, it seems that there are a few typos.
"does not parse as a <partDirective>
" - maybe < partDeclaration >
?
"does not denote the library of P" - we can have partDirective
s not only in libraries, so maybe "the file with URI P"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK, <partDeclaration>
for the entire part file, <partDirective>
for the part "...";
directive.
And yes, "the file P" is correct. (Damn! I hoped I had found all of the places that assumed a parent file was a library.)
…tions.
Unifies "augmentation libraries" and part files.
Part files can have imports, exports and further part files. Part files can use configurable URIs.
A
part of
directive can no longer use a library name. Part files inherit the imports of their parent file, and can extend or shadow those with their own imports.Augmentation declarations can occur in any part or library file. An augmentation must occur "below" the declaration it augments: Either later in the same file ("below" when viewing code), or in the file-tree of a part file of the same file ("below" in the part-file tree of the library).
This ensures that the original declaration occurs above all augmentations of it, and that all augmentations of the same original declaration occur on a single path down the part-file tree of the library. What again ensures that reordering
part
directives does not change the order of augmentations.Changed the lexical scope of augmenting class-like declarations (declarations with a member scope) to only contain the members declared inside the same class-like declaration, not the collection of all members declared by all declarations with the same name.
Rewrote the part about applying augmentations. This is more speculative since it doesn't provide a complete definition, but more of a pattern for extending semantics that assume a name refers to a single declaration, into one where a name denotes a set (stack depending on augmentation application order), of individual syntactic declarations.
The existing semi-syntactic "merging" may not be a viable specification approach, since it requires merging code from different scopes into a single scope. That's not impossible, we also move code around for mixin applications, but it's also easy to get wrong.