Skip to content

Commit

Permalink
add code to handle disabling macros
Browse files Browse the repository at this point in the history
  • Loading branch information
kevaundray committed Dec 12, 2023
1 parent 6c266dc commit 3bb1c2e
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 6 deletions.
2 changes: 1 addition & 1 deletion tooling/lsp/src/notifications/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ pub(super) fn on_did_save_text_document(
.flat_map(|package| -> Vec<Diagnostic> {
let (mut context, crate_id) = prepare_package(package, Box::new(get_non_stdlib_asset));

let file_diagnostics = match check_crate(&mut context, crate_id, false) {
let file_diagnostics = match check_crate(&mut context, crate_id, false, false) {
Ok(((), warnings)) => warnings,
Err(errors_and_warnings) => errors_and_warnings,
};
Expand Down
2 changes: 1 addition & 1 deletion tooling/lsp/src/requests/code_lens_request.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ fn on_code_lens_request_inner(
let (mut context, crate_id) = prepare_package(package, Box::new(get_non_stdlib_asset));
// We ignore the warnings and errors produced by compilation for producing code lenses
// because we can still get the test functions even if compilation fails
let _ = check_crate(&mut context, crate_id, false);
let _ = check_crate(&mut context, crate_id, false, false);

let fm = &context.file_manager;
let files = fm.as_file_map();
Expand Down
2 changes: 1 addition & 1 deletion tooling/lsp/src/requests/goto_definition.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ fn on_goto_definition_inner(
nargo::prepare_package(package, Box::new(crate::get_non_stdlib_asset));

// We ignore the warnings and errors produced by compilation while resolving the definition
let _ = noirc_driver::check_crate(&mut context, crate_id, false);
let _ = noirc_driver::check_crate(&mut context, crate_id, false, false);

let files = context.file_manager.as_file_map();
let file_id = context.file_manager.name_to_id(file_path.clone());
Expand Down
2 changes: 1 addition & 1 deletion tooling/lsp/src/requests/test_run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ fn on_test_run_request_inner(
match workspace.into_iter().next() {
Some(package) => {
let (mut context, crate_id) = prepare_package(package, Box::new(get_non_stdlib_asset));
if check_crate(&mut context, crate_id, false).is_err() {
if check_crate(&mut context, crate_id, false, false).is_err() {
let result = NargoTestRunResult {
id: params.id.clone(),
result: "error".to_string(),
Expand Down
2 changes: 1 addition & 1 deletion tooling/lsp/src/requests/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ fn on_tests_request_inner(
let (mut context, crate_id) = prepare_package(package, Box::new(get_non_stdlib_asset));
// We ignore the warnings and errors produced by compilation for producing tests
// because we can still get the test functions even if compilation fails
let _ = check_crate(&mut context, crate_id, false);
let _ = check_crate(&mut context, crate_id, false, false);

// We don't add test headings for a package if it contains no `#[test]` functions
get_package_tests_in_crate(&context, &crate_id, &package.name)
Expand Down
4 changes: 3 additions & 1 deletion tooling/nargo_cli/src/cli/check_cmd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ fn check_package(package: &Package, compile_options: &CompileOptions) -> Result<
&mut context,
crate_id,
compile_options.deny_warnings,
compile_options.disable_macros,
compile_options.silence_warnings,
)?;

Expand Down Expand Up @@ -182,9 +183,10 @@ pub(crate) fn check_crate_and_report_errors(
context: &mut Context,
crate_id: CrateId,
deny_warnings: bool,
disable_macros: bool,
silence_warnings: bool,
) -> Result<(), CompileError> {
let result = check_crate(context, crate_id, deny_warnings);
let result = check_crate(context, crate_id, deny_warnings, disable_macros);
super::compile_cmd::report_errors(
result,
&context.file_manager,
Expand Down
1 change: 1 addition & 0 deletions tooling/nargo_cli/src/cli/test_cmd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ fn run_tests<S: BlackBoxFunctionSolver>(
&mut context,
crate_id,
compile_options.deny_warnings,
compile_options.disable_macros,
compile_options.silence_warnings,
)?;

Expand Down

0 comments on commit 3bb1c2e

Please sign in to comment.