Skip to content

Commit

Permalink
checking forbidden names when generating c files and error in --> che…
Browse files Browse the repository at this point in the history
…cking in anonymous components with multiple outputs
  • Loading branch information
clararod9 committed Jun 22, 2023
1 parent 77b36a9 commit 29ea1ac
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
12 changes: 10 additions & 2 deletions circom/src/input_user.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,19 @@ const JSON: &'static str = "json";

impl Input {
pub fn new() -> Result<Input, ()> {
use ansi_term::Colour;
use input_processing::SimplificationStyle;
let matches = input_processing::view();
let input = input_processing::get_input(&matches)?;
let file_name = input.file_stem().unwrap().to_str().unwrap().to_string();
let mut file_name = input.file_stem().unwrap().to_str().unwrap().to_string();
let output_path = input_processing::get_output_path(&matches)?;

let c_flag = input_processing::get_c(&matches);

if c_flag && (file_name == "main" || file_name == "fr" || file_name == "calcwit"){
println!("{}", Colour::Yellow.paint(format!("The name {} is reserved in Circom when using de --c flag. The files generated for your circuit will use the name {}_c instead of {}.", file_name, file_name, file_name)));
file_name = format!("{}_c", file_name)
};
let output_c_path = Input::build_folder(&output_path, &file_name, CPP);
let output_js_path = Input::build_folder(&output_path, &file_name, JS);
let o_style = input_processing::get_simplification_style(&matches)?;
Expand All @@ -76,7 +84,7 @@ impl Input {
),
wat_flag:input_processing::get_wat(&matches),
wasm_flag: input_processing::get_wasm(&matches),
c_flag: input_processing::get_c(&matches),
c_flag: c_flag,
r1cs_flag: input_processing::get_r1cs(&matches),
sym_flag: input_processing::get_sym(&matches),
main_inputs_flag: input_processing::get_main_inputs_log(&matches),
Expand Down
2 changes: 1 addition & 1 deletion parser/src/syntax_sugar_remover.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ fn check_anonymous_components_statement(
"An anonymous component cannot be used in the left side of an assignment".to_string())
)
} else{
if rhe.contains_anonymous_comp() && *op != AssignOp::AssignSignal{
if rhe.contains_anonymous_comp() && *op == AssignOp::AssignSignal{
let error = format!("Anonymous components only admit the use of the operator <==");
Result::Err(anonymous_general_error(meta.clone(),error))
} else{
Expand Down

0 comments on commit 29ea1ac

Please sign in to comment.