mirror of
https://github.com/roc-lang/roc.git
synced 2025-08-03 19:58:18 +00:00
Support both inline and header imports
Load will now convert header imports to inline import defs, so that we can support both temporarily.
This commit is contained in:
parent
7a53484479
commit
7ebfc6d06d
18 changed files with 235 additions and 121 deletions
|
@ -2,7 +2,7 @@ use bumpalo::Bump;
|
|||
use roc_fmt::{annotation::Formattable, module::fmt_module};
|
||||
use roc_parse::{
|
||||
ast::{Defs, Expr, Malformed, Module},
|
||||
module::module_defs,
|
||||
module::parse_module_defs,
|
||||
parser::{Parser, SyntaxError},
|
||||
state::State,
|
||||
test_helpers::{parse_defs_with, parse_expr_with, parse_header_with},
|
||||
|
@ -170,9 +170,7 @@ impl<'a> Input<'a> {
|
|||
.parse(arena, state.clone(), min_indent)
|
||||
.map_err(|(_, fail)| SyntaxError::Header(fail))?;
|
||||
|
||||
let (_, module_defs, _state) = module_defs()
|
||||
.parse(arena, state, min_indent)
|
||||
.map_err(|(_, fail)| fail)?;
|
||||
let module_defs = parse_module_defs(arena, state, Defs::default()).unwrap();
|
||||
|
||||
Ok(Output::Full {
|
||||
header,
|
||||
|
|
|
@ -7,9 +7,8 @@ mod test_fmt {
|
|||
use roc_fmt::def::fmt_defs;
|
||||
use roc_fmt::module::fmt_module;
|
||||
use roc_fmt::Buf;
|
||||
use roc_parse::ast::Module;
|
||||
use roc_parse::module::{self, module_defs};
|
||||
use roc_parse::parser::Parser;
|
||||
use roc_parse::ast::{Defs, Module};
|
||||
use roc_parse::module::{self, parse_module_defs};
|
||||
use roc_parse::state::State;
|
||||
use roc_test_utils::assert_multiline_str_eq;
|
||||
use roc_test_utils_dir::workspace_root;
|
||||
|
@ -39,8 +38,8 @@ mod test_fmt {
|
|||
) {
|
||||
fmt_module(buf, module);
|
||||
|
||||
match module_defs().parse(arena, state, 0) {
|
||||
Ok((_, loc_defs, _)) => {
|
||||
match parse_module_defs(arena, state, Defs::default()) {
|
||||
Ok(loc_defs) => {
|
||||
fmt_defs(buf, &loc_defs, 0);
|
||||
}
|
||||
Err(error) => panic!(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue