mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-28 06:14:46 +00:00
cleanup+fmt+clippy
This commit is contained in:
parent
548d806a88
commit
4324b08a30
14 changed files with 121 additions and 267 deletions
|
@ -1,27 +1,36 @@
|
|||
use roc_ast::{ast_error::ASTResult, lang::{self, core::def::def_to_def2::def_to_def2}, mem_pool::pool::Pool};
|
||||
use bumpalo::{collections::String as BumpString, Bump};
|
||||
use roc_ast::{
|
||||
ast_error::ASTResult,
|
||||
lang::{self, core::def::def_to_def2::def_to_def2},
|
||||
mem_pool::pool::Pool,
|
||||
};
|
||||
use roc_code_markup::{markup::nodes::def2_to_markup, slow_pool::SlowPool};
|
||||
use roc_module::symbol::{IdentIds, Interns, ModuleId, ModuleIds};
|
||||
use roc_region::all::Region;
|
||||
use bumpalo::{Bump, collections::String as BumpString};
|
||||
use roc_types::subs::VarStore;
|
||||
|
||||
use crate::html::mark_node_to_html;
|
||||
|
||||
// html is written to buf
|
||||
pub fn defs_to_html<'a>(buf: &mut BumpString<'a>, defs: Vec<roc_parse::ast::Def<'a>>, env_module_id: ModuleId, env_module_ids: &'a ModuleIds, interns: &Interns) {
|
||||
|
||||
pub fn defs_to_html<'a>(
|
||||
buf: &mut BumpString<'a>,
|
||||
defs: Vec<roc_parse::ast::Def<'a>>,
|
||||
env_module_id: ModuleId,
|
||||
env_module_ids: &'a ModuleIds,
|
||||
interns: &Interns,
|
||||
) {
|
||||
let mut env_pool = Pool::with_capacity(1024);
|
||||
let mut env_arena = Bump::new();
|
||||
let env_arena = Bump::new();
|
||||
|
||||
let mut var_store = VarStore::default();
|
||||
let dep_idents = IdentIds::exposed_builtins(8);
|
||||
let exposed_ident_ids = IdentIds::default();
|
||||
|
||||
let def_arena = Bump::new();
|
||||
|
||||
|
||||
let mut env = lang::env::Env::new(
|
||||
env_module_id,
|
||||
&mut env_arena,
|
||||
&env_arena,
|
||||
&mut env_pool,
|
||||
&mut var_store,
|
||||
dep_idents,
|
||||
|
@ -32,60 +41,13 @@ pub fn defs_to_html<'a>(buf: &mut BumpString<'a>, defs: Vec<roc_parse::ast::Def<
|
|||
let mut scope = lang::scope::Scope::new(env.home, env.pool, env.var_store);
|
||||
let region = Region::new(0, 0, 0, 0);
|
||||
|
||||
|
||||
|
||||
for def in defs.iter() {
|
||||
// TODO remove unwrap
|
||||
write_def_to_bump_str_html(
|
||||
&def_arena,
|
||||
&mut env,
|
||||
&mut scope,
|
||||
region,
|
||||
&def,
|
||||
interns,
|
||||
buf
|
||||
).unwrap();
|
||||
write_def_to_bump_str_html(&def_arena, &mut env, &mut scope, region, def, interns, buf)
|
||||
.unwrap();
|
||||
}
|
||||
}
|
||||
|
||||
// html is written to buf
|
||||
pub fn def_to_html<'a>(buf: &mut BumpString<'a>, def: roc_parse::ast::Def<'a>, env_module_id: ModuleId, env_module_ids: &'a ModuleIds, interns: &Interns) {
|
||||
|
||||
let mut env_pool = Pool::with_capacity(1024);
|
||||
let mut env_arena = Bump::new();
|
||||
|
||||
let mut var_store = VarStore::default();
|
||||
let dep_idents = IdentIds::exposed_builtins(8);
|
||||
let exposed_ident_ids = IdentIds::default();
|
||||
|
||||
let def_arena = Bump::new();
|
||||
|
||||
let mut env = lang::env::Env::new(
|
||||
env_module_id,
|
||||
&mut env_arena,
|
||||
&mut env_pool,
|
||||
&mut var_store,
|
||||
dep_idents,
|
||||
env_module_ids,
|
||||
exposed_ident_ids,
|
||||
);
|
||||
|
||||
let mut scope = lang::scope::Scope::new(env.home, env.pool, env.var_store);
|
||||
let region = Region::new(0, 0, 0, 0);
|
||||
|
||||
|
||||
// TODO remove unwrap
|
||||
write_def_to_bump_str_html(
|
||||
&def_arena,
|
||||
&mut env,
|
||||
&mut scope,
|
||||
region,
|
||||
&def,
|
||||
interns,
|
||||
buf
|
||||
).unwrap();
|
||||
}
|
||||
|
||||
fn write_def_to_bump_str_html<'a, 'b>(
|
||||
arena: &'a Bump,
|
||||
env: &mut lang::env::Env<'a>,
|
||||
|
@ -93,9 +55,8 @@ fn write_def_to_bump_str_html<'a, 'b>(
|
|||
region: Region,
|
||||
def: &'a roc_parse::ast::Def<'a>,
|
||||
interns: &Interns,
|
||||
buf: &mut BumpString<'b>
|
||||
buf: &mut BumpString<'b>,
|
||||
) -> ASTResult<()> {
|
||||
|
||||
let def2 = def_to_def2(arena, env, scope, def, region);
|
||||
|
||||
let mut def2_pool = Pool::with_capacity(1024);
|
||||
|
@ -105,7 +66,7 @@ fn write_def_to_bump_str_html<'a, 'b>(
|
|||
|
||||
let def2_markup_id = def2_to_markup(
|
||||
env,
|
||||
&def2_pool.get(def2_id),
|
||||
def2_pool.get(def2_id),
|
||||
def2_id,
|
||||
&mut mark_node_pool,
|
||||
interns,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue