[fine] export, dump source map, lookup fix
This commit is contained in:
parent
a3ae4339cf
commit
a21f18da6e
4 changed files with 65 additions and 16 deletions
|
|
@ -163,7 +163,7 @@ pub enum Type {
|
|||
Alternate(Box<[Type]>),
|
||||
|
||||
// A module of some kind. What module?
|
||||
Module(ImportRecord),
|
||||
Module(Rc<str>, ImportRecord),
|
||||
}
|
||||
|
||||
impl Type {
|
||||
|
|
@ -258,7 +258,7 @@ impl fmt::Display for Type {
|
|||
}
|
||||
Ok(())
|
||||
}
|
||||
Module(name) => write!(f, "module {}", name.name),
|
||||
Module(name, _) => write!(f, "module {}", name),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -2245,9 +2245,9 @@ impl Semantics {
|
|||
self.internal_compiler_error(None, "import map not initialized");
|
||||
};
|
||||
|
||||
let name = tok.as_str(&self.source);
|
||||
match import_map.get(name) {
|
||||
Some(import) => Some(Type::Module(import.clone())),
|
||||
let name = string_constant_to_string(tok.as_str(&self.source));
|
||||
match import_map.get(&name) {
|
||||
Some(import) => Some(Type::Module(name.into(), import.clone())),
|
||||
None => {
|
||||
self.report_error_tree(tree, format!("unable to resolve module import {name}"));
|
||||
Some(Type::Error)
|
||||
|
|
@ -2405,6 +2405,21 @@ impl Semantics {
|
|||
}
|
||||
}
|
||||
|
||||
{
|
||||
match self.import_map.get() {
|
||||
Some(m) => {
|
||||
eprintln!("Import map:");
|
||||
for (k, b) in m.iter() {
|
||||
eprintln!(" {k} => {} ({})", b.name, b.module_id);
|
||||
}
|
||||
eprintln!();
|
||||
}
|
||||
None => {
|
||||
eprintln!("The import map is not set.\n")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if let Some(tr) = tr {
|
||||
eprintln!("This is about the tree: {:?}", &self.syntax_tree[tr]);
|
||||
eprintln!("The logical parent chain of the tree was:\n");
|
||||
|
|
@ -2529,6 +2544,9 @@ pub fn check(s: &Semantics) {
|
|||
TreeKind::Import => {
|
||||
let _ = s.type_of(t);
|
||||
}
|
||||
|
||||
TreeKind::Export => {}
|
||||
TreeKind::ExportList => {}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue