mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-28 22:34:45 +00:00
cleanup+fmt+clippy
This commit is contained in:
parent
548d806a88
commit
4324b08a30
14 changed files with 121 additions and 267 deletions
|
@ -1,17 +1,26 @@
|
|||
use crate::html::{mark_node_to_html};
|
||||
use roc_ast::{ast_error::ASTResult, lang::{self, core::expr::expr_to_expr2::expr_to_expr2}, mem_pool::pool::Pool};
|
||||
use crate::html::mark_node_to_html;
|
||||
use bumpalo::{collections::String as BumpString, Bump};
|
||||
use roc_ast::{
|
||||
ast_error::ASTResult,
|
||||
lang::{self, core::expr::expr_to_expr2::expr_to_expr2},
|
||||
mem_pool::pool::Pool,
|
||||
};
|
||||
use roc_code_markup::{markup::nodes::expr2_to_markup, slow_pool::SlowPool};
|
||||
use roc_module::symbol::{IdentIds, Interns, ModuleId, ModuleIds};
|
||||
use roc_parse::ast::{Expr};
|
||||
use roc_region::all::{Region};
|
||||
use bumpalo::{Bump, collections::String as BumpString};
|
||||
use roc_parse::ast::Expr;
|
||||
use roc_region::all::Region;
|
||||
use roc_types::subs::VarStore;
|
||||
|
||||
// html is written to buf
|
||||
pub fn expr_to_html<'a>(buf: &mut BumpString<'a>, expr: Expr<'a>, env_module_id: ModuleId, env_module_ids: &'a ModuleIds, interns: &Interns) {
|
||||
|
||||
pub fn expr_to_html<'a>(
|
||||
buf: &mut BumpString<'a>,
|
||||
expr: Expr<'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);
|
||||
|
@ -19,7 +28,7 @@ pub fn expr_to_html<'a>(buf: &mut BumpString<'a>, expr: Expr<'a>, env_module_id:
|
|||
|
||||
let mut env = lang::env::Env::new(
|
||||
env_module_id,
|
||||
&mut env_arena,
|
||||
&env_arena,
|
||||
&mut env_pool,
|
||||
&mut var_store,
|
||||
dep_idents,
|
||||
|
@ -31,14 +40,7 @@ pub fn expr_to_html<'a>(buf: &mut BumpString<'a>, expr: Expr<'a>, env_module_id:
|
|||
let region = Region::new(0, 0, 0, 0);
|
||||
|
||||
// TODO remove unwrap
|
||||
write_expr_to_bump_str_html(
|
||||
&mut env,
|
||||
&mut scope,
|
||||
region,
|
||||
&expr,
|
||||
interns,
|
||||
buf
|
||||
).unwrap();
|
||||
write_expr_to_bump_str_html(&mut env, &mut scope, region, &expr, interns, buf).unwrap();
|
||||
}
|
||||
|
||||
fn write_expr_to_bump_str_html<'a, 'b>(
|
||||
|
@ -47,7 +49,7 @@ fn write_expr_to_bump_str_html<'a, 'b>(
|
|||
region: Region,
|
||||
expr: &'a Expr,
|
||||
interns: &Interns,
|
||||
buf: &mut BumpString<'b>
|
||||
buf: &mut BumpString<'b>,
|
||||
) -> ASTResult<()> {
|
||||
let (expr2, _) = expr_to_expr2(env, scope, expr, region);
|
||||
|
||||
|
@ -58,7 +60,7 @@ fn write_expr_to_bump_str_html<'a, 'b>(
|
|||
|
||||
let expr2_markup_id = expr2_to_markup(
|
||||
env,
|
||||
&expr2_pool.get(expr2_id),
|
||||
expr2_pool.get(expr2_id),
|
||||
expr2_id,
|
||||
&mut mark_node_pool,
|
||||
interns,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue