Kernel only attribute annotation (#76) #127

Merged
sb10q merged 8 commits from kernel_only_annotation into master 2021-12-19 11:04:53 +08:00
2 changed files with 11 additions and 5 deletions
Showing only changes of commit cbf83bcc8c - Show all commits

View File

@ -14,6 +14,15 @@ pub struct ComposerConfig {
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<()>>);
pub struct TopLevelComposer {
// list of top level definitions, same as top level context
@ -35,10 +44,7 @@ pub struct TopLevelComposer {
impl Default for TopLevelComposer {
fn default() -> Self {
Self::new(vec![], ComposerConfig {
kernel_ann: None,
kernel_invariant_ann: "Invariant"
}).0
Self::new(vec![], Default::default()).0
}
}

View File

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

You implemented Default already - don't repeat yourself?

You implemented ``Default`` already - don't repeat yourself?
);
let internal_resolver: Arc<ResolverInternal> = ResolverInternal {