nac3core/standalone: use default for ComposerConfig

This commit is contained in:
ychenfo 2021-12-19 02:55:38 +08:00
parent 5f24d63b0b
commit cbf83bcc8c
2 changed files with 11 additions and 5 deletions

View File

@ -14,6 +14,15 @@ pub struct ComposerConfig {
pub kernel_invariant_ann: &'static str, pub kernel_invariant_ann: &'static str,
} }
impl Default for ComposerConfig {
fn default() -> Self {
ComposerConfig {
kernel_ann: None,
kernel_invariant_ann: "Invariant"
}
}
}
type DefAst = (Arc<RwLock<TopLevelDef>>, Option<ast::Stmt<()>>); type DefAst = (Arc<RwLock<TopLevelDef>>, Option<ast::Stmt<()>>);
pub struct TopLevelComposer { pub struct TopLevelComposer {
// list of top level definitions, same as top level context // list of top level definitions, same as top level context
@ -35,10 +44,7 @@ pub struct TopLevelComposer {
impl Default for TopLevelComposer { impl Default for TopLevelComposer {
fn default() -> Self { fn default() -> Self {
Self::new(vec![], ComposerConfig { Self::new(vec![], Default::default()).0
kernel_ann: None,
kernel_invariant_ann: "Invariant"
}).0
} }
} }

View File

@ -46,7 +46,7 @@ fn main() {
let primitive: PrimitiveStore = TopLevelComposer::make_primitives().0; let primitive: PrimitiveStore = TopLevelComposer::make_primitives().0;
let (mut composer, builtins_def, builtins_ty) = TopLevelComposer::new( let (mut composer, builtins_def, builtins_ty) = TopLevelComposer::new(
vec![], vec![],
ComposerConfig { kernel_ann: None, kernel_invariant_ann: "Invariant" } Default::default()
); );
let internal_resolver: Arc<ResolverInternal> = ResolverInternal { let internal_resolver: Arc<ResolverInternal> = ResolverInternal {