Compare commits

...

2 Commits

2 changed files with 5 additions and 4 deletions

View File

@ -37,7 +37,7 @@ pub struct TopLevelComposer {
// number of built-in function and classes in the definition list, later skip
pub builtin_num: usize,
pub core_config: ComposerConfig,
// the class name and it's constructor function
// the class name and its constructor function
pub constructor_lookup: HashMap<StrRef, ast::Located<ast::StmtKind>>,
}
@ -185,7 +185,7 @@ impl TopLevelComposer {
return Some((**class_name, stmt.clone()))
}
}
return None
None
})
);

View File

@ -706,8 +706,9 @@ fn test_build_constructor_lookup(source: &str, result: HashMap<ast::StrRef, ast:
composer.build_constructor_lookup(stmts.iter())
}
assert_eq!(result.get(&"A".into()).unwrap(), result.get(&"B".into()).unwrap());
assert_eq!(result.get(&"B".into()).unwrap(), result.get(&"C".into()).unwrap());
assert_eq!(result.get(&"A".into()).unwrap(), composer.constructor_lookup.get(&"A".into()).unwrap());
assert_eq!(result.get(&"B".into()).unwrap(), composer.constructor_lookup.get(&"B".into()).unwrap());
assert_eq!(result.get(&"C".into()).unwrap(), composer.constructor_lookup.get(&"C".into()).unwrap());
}