fixed scope lookup bug

This commit is contained in:
Anton-4 2021-10-19 16:45:28 +02:00
parent 0a77b3f334
commit c7c421b2f5
19 changed files with 212 additions and 185 deletions

View file

@ -4,8 +4,11 @@ use roc_ast::{
lang::{self, core::def::def_to_def2::def_to_def2},
mem_pool::pool::Pool,
};
use roc_code_markup::{markup::{convert::from_def2::def2_to_markup, nodes::tree_as_string}, slow_pool::SlowPool};
use roc_module::symbol::{IdentIds, Interns, ModuleId, ModuleIds};
use roc_code_markup::{
markup::{convert::from_def2::def2_to_markup, nodes::tree_as_string},
slow_pool::SlowPool,
};
use roc_module::symbol::{IdentIds, Interns, ModuleId};
use roc_region::all::Region;
use roc_types::subs::VarStore;
@ -16,7 +19,6 @@ 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: &mut Interns,
) -> DocsResult<()> {
let mut env_pool = Pool::with_capacity(1024);
@ -34,12 +36,12 @@ pub fn defs_to_html<'a>(
&mut env_pool,
&mut var_store,
dep_idents,
env_module_ids,
&interns.module_ids,
exposed_ident_ids,
);
let mut scope = lang::scope::Scope::new(env.home, env.pool, env.var_store);
scope.fill_scope(&env, interns)?;
scope.fill_scope(&env, &mut interns.all_ident_ids)?;
let region = Region::new(0, 0, 0, 0);
@ -74,7 +76,10 @@ fn write_def_to_bump_str_html<'a, 'b>(
interns,
)?;
println!("MARKUP_TREE {}", tree_as_string(def2_markup_id, &mark_node_pool));
println!(
"MARKUP_TREE {}",
tree_as_string(def2_markup_id, &mark_node_pool)
);
let def2_markup_node = mark_node_pool.get(def2_markup_id);