mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-28 22:34:45 +00:00
fixed scope lookup bug
This commit is contained in:
parent
0a77b3f334
commit
c7c421b2f5
19 changed files with 212 additions and 185 deletions
|
@ -1,4 +1,4 @@
|
|||
use crate::{docs_error::DocsResult, html::mark_node_to_html};
|
||||
use crate::html::mark_node_to_html;
|
||||
use bumpalo::{collections::String as BumpString, Bump};
|
||||
use roc_ast::{
|
||||
ast_error::ASTResult,
|
||||
|
@ -6,8 +6,7 @@ use roc_ast::{
|
|||
mem_pool::pool::Pool,
|
||||
};
|
||||
use roc_code_markup::{markup::convert::from_expr2::expr2_to_markup, slow_pool::SlowPool};
|
||||
use roc_load::file::LoadedModule;
|
||||
use roc_module::symbol::{IdentIds, Interns};
|
||||
use roc_module::symbol::{IdentIds, Interns, ModuleId, ModuleIds};
|
||||
use roc_parse::ast::Expr;
|
||||
use roc_region::all::Region;
|
||||
use roc_types::subs::VarStore;
|
||||
|
@ -16,38 +15,35 @@ use roc_types::subs::VarStore;
|
|||
pub fn expr_to_html<'a>(
|
||||
buf: &mut BumpString<'a>,
|
||||
expr: Expr<'a>,
|
||||
loaded_module: &mut LoadedModule
|
||||
) -> DocsResult<()> {
|
||||
env_module_id: ModuleId,
|
||||
env_module_ids: &'a ModuleIds,
|
||||
interns: &Interns,
|
||||
) {
|
||||
let mut env_pool = Pool::with_capacity(1024);
|
||||
let 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 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,
|
||||
&env_arena,
|
||||
&mut env_pool,
|
||||
&mut var_store,
|
||||
dep_idents,
|
||||
env_module_ids,
|
||||
exposed_ident_ids,
|
||||
);
|
||||
|
||||
let mut env = lang::env::Env::new(
|
||||
loaded_module.module_id,
|
||||
&env_arena,
|
||||
&mut env_pool,
|
||||
&mut var_store,
|
||||
dep_idents,
|
||||
&loaded_module.interns.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);
|
||||
|
||||
let mut scope = lang::scope::Scope::new(env.home, env.pool, env.var_store);
|
||||
scope.fill_scope(&env, &mut loaded_module.interns).unwrap();
|
||||
|
||||
let region = Region::new(0, 0, 0, 0);
|
||||
|
||||
write_expr_to_bump_str_html(&mut env, &mut scope, region, &expr, &loaded_module.interns, buf)?;
|
||||
|
||||
Ok(())
|
||||
// TODO remove unwrap
|
||||
write_expr_to_bump_str_html(&mut env, &mut scope, region, &expr, interns, buf).unwrap();
|
||||
}
|
||||
|
||||
pub fn write_expr_to_bump_str_html<'a, 'b>(
|
||||
fn write_expr_to_bump_str_html<'a, 'b>(
|
||||
env: &mut lang::env::Env<'a>,
|
||||
scope: &mut lang::scope::Scope,
|
||||
region: Region,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue