mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-26 21:39:07 +00:00
New module
header
Implements the new `module` header syntax as described in "module and package changes" [1]: ``` module [Request, Response, req] ``` The old syntax should still work fine, and is automatically upgraded to the new one when running `roc format`. [1] https://docs.google.com/document/d/1E_77fO-44BtoBtXoVeWyGh1xN2KRTWTu8q6i25RNNx0/edit
This commit is contained in:
parent
7754dd7ef7
commit
057a18573a
92 changed files with 1445 additions and 1563 deletions
|
@ -11,9 +11,8 @@ use roc_parse::{
|
|||
WhenBranch,
|
||||
},
|
||||
header::{
|
||||
AppHeader, ExposedName, HostedHeader, ImportsEntry, InterfaceHeader, ModuleName,
|
||||
PackageEntry, PackageHeader, PackageName, PlatformHeader, PlatformRequires, ProvidesTo, To,
|
||||
TypedIdent,
|
||||
AppHeader, ExposedName, HostedHeader, ImportsEntry, ModuleHeader, ModuleName, PackageEntry,
|
||||
PackageHeader, PackageName, PlatformHeader, PlatformRequires, ProvidesTo, To, TypedIdent,
|
||||
},
|
||||
ident::{Accessor, UppercaseIdent},
|
||||
};
|
||||
|
@ -202,7 +201,7 @@ impl IterTokens for Module<'_> {
|
|||
impl IterTokens for Header<'_> {
|
||||
fn iter_tokens<'a>(&self, arena: &'a Bump) -> BumpVec<'a, Loc<Token>> {
|
||||
match self {
|
||||
Header::Interface(ih) => ih.iter_tokens(arena),
|
||||
Header::Module(mh) => mh.iter_tokens(arena),
|
||||
Header::App(app) => app.iter_tokens(arena),
|
||||
Header::Package(pkg) => pkg.iter_tokens(arena),
|
||||
Header::Platform(pf) => pf.iter_tokens(arena),
|
||||
|
@ -211,19 +210,15 @@ impl IterTokens for Header<'_> {
|
|||
}
|
||||
}
|
||||
|
||||
impl IterTokens for InterfaceHeader<'_> {
|
||||
impl IterTokens for ModuleHeader<'_> {
|
||||
fn iter_tokens<'a>(&self, arena: &'a Bump) -> BumpVec<'a, Loc<Token>> {
|
||||
let Self {
|
||||
before_name: _,
|
||||
name,
|
||||
before_exposes: _,
|
||||
exposes,
|
||||
imports,
|
||||
interface_imports: _,
|
||||
} = self;
|
||||
|
||||
(name.iter_tokens(arena).into_iter())
|
||||
.chain(exposes.item.iter_tokens(arena))
|
||||
.chain(imports.item.iter_tokens(arena))
|
||||
.collect_in(arena)
|
||||
exposes.iter_tokens(arena)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue