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:
Agus Zubiaga 2024-04-20 18:57:53 -03:00
parent 7a53484479
commit 7ebfc6d06d
No known key found for this signature in database
18 changed files with 235 additions and 121 deletions

View file

@ -1,6 +1,10 @@
use bumpalo::Bump;
use criterion::{black_box, criterion_group, criterion_main, Criterion};
use roc_parse::{module, module::module_defs, parser::Parser, state::State};
use roc_parse::{
ast::Defs,
module::{self, parse_module_defs},
state::State,
};
use std::path::PathBuf;
pub fn parse_benchmark(c: &mut Criterion) {
@ -18,11 +22,7 @@ pub fn parse_benchmark(c: &mut Criterion) {
let (_actual, state) =
module::parse_header(&arena, State::new(src.as_bytes())).unwrap();
let min_indent = 0;
let res = module_defs()
.parse(&arena, state, min_indent)
.map(|tuple| tuple.1)
.unwrap();
let res = parse_module_defs(&arena, state, Defs::default()).unwrap();
black_box(res.len());
})
@ -43,11 +43,7 @@ pub fn parse_benchmark(c: &mut Criterion) {
let (_actual, state) =
module::parse_header(&arena, State::new(src.as_bytes())).unwrap();
let min_indent = 0;
let res = module_defs()
.parse(&arena, state, min_indent)
.map(|tuple| tuple.1)
.unwrap();
let res = parse_module_defs(&arena, state, Defs::default()).unwrap();
black_box(res.len());
})