Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ cairo-lang-defs = "*"
cairo-lang-diagnostics = "*"
cairo-lang-filesystem = "*"
cairo-lang-formatter = "*"
cairo-lang-lowering = "*"
cairo-lang-parser = "*"
cairo-lang-semantic = "*"
cairo-lang-syntax = "*"
Expand Down
6 changes: 6 additions & 0 deletions src/context.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
use crate::fixer::InternalFix;
use crate::lints::assert_on_const::AssertOnConst;
use crate::lints::assert_on_const::check_assert_on_const;
use crate::lints::bitwise_for_parity_check::BitwiseForParity;
use crate::lints::bitwise_for_parity_check::check_bitwise_for_parity;
use crate::lints::bool_comparison::BoolComparison;
Expand Down Expand Up @@ -403,6 +405,10 @@ impl LintContext {
lints: vec![Box::new(ManualUnwrapOrElse)],
check_function: check_manual_unwrap_or_else,
},
LintRuleGroup {
lints: vec![Box::new(AssertOnConst)],
check_function: check_assert_on_const,
},
]
}

Expand Down
9 changes: 8 additions & 1 deletion src/fixer/db.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use cairo_lang_defs::db::{defs_group_input, init_external_files};
use cairo_lang_filesystem::db::files_group_input;
use cairo_lang_lowering::{db::init_lowering_group, optimizations::config::Optimizations};
use cairo_lang_semantic::db::semantic_group_input;

use salsa::{Database, Setter};

#[salsa::db]
Expand All @@ -15,6 +15,13 @@ impl salsa::Database for FixerDatabase {}
impl FixerDatabase {
pub fn new_from(db: &dyn Database) -> Self {
let mut new_db = Self::new();

init_lowering_group(
&mut new_db,
Optimizations::enabled_with_minimal_movable_functions(),
None,
);

// SemanticGroup salsa inputs.
semantic_group_input(&new_db)
.set_default_analyzer_plugins(&mut new_db)
Expand Down
7 changes: 6 additions & 1 deletion src/lang/db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ use cairo_lang_filesystem::{
flag::Flag,
ids::FlagLongId,
};
use cairo_lang_lowering::{db::init_lowering_group, optimizations::config::Optimizations};
use cairo_lang_semantic::{
db::{init_semantic_group, semantic_group_input},
ids::AnalyzerPluginLongId,
Expand Down Expand Up @@ -44,6 +45,11 @@ impl LinterAnalysisDatabase {
init_defs_group(&mut res);
init_semantic_group(&mut res);
init_external_files(&mut res);
init_lowering_group(
&mut res,
Optimizations::enabled_with_minimal_movable_functions(),
None,
);

default_plugin_suite.add(cairo_lint_allow_plugin_suite());

Expand Down Expand Up @@ -74,7 +80,6 @@ impl LinterAnalysisDatabase {
.map(AnalyzerPluginLongId)
.collect(),
));

res
}
}
Expand Down
Loading