add parameter to the function register_top_level

pull/304/head
z78078 2022-07-06 16:15:04 +08:00
parent 8ee10802c9
commit 29525e222a
1 changed files with 2 additions and 1 deletions

View File

@ -164,6 +164,7 @@ impl TopLevelComposer {
ast: ast::Stmt<()>,
resolver: Option<Arc<dyn SymbolResolver + Send + Sync>>,
mod_path: String,
allow_no_constructor: bool,
) -> Result<(StrRef, DefinitionId, Option<Type>), String> {
let defined_names = &mut self.defined_names;
match &ast.node {
@ -298,7 +299,7 @@ impl TopLevelComposer {
self.definition_ast_list.push((def, Some(ast)));
}
let result_ty = if contains_constructor { Some(constructor_ty) } else { None };
let result_ty = if allow_no_constructor || contains_constructor { Some(constructor_ty) } else { None };
Ok((class_name, DefinitionId(class_def_id), result_ty))
}