diff --git a/compiler/src/compiler.rs b/compiler/src/compiler.rs index 42863ab92f..bb6b507e86 100644 --- a/compiler/src/compiler.rs +++ b/compiler/src/compiler.rs @@ -83,6 +83,7 @@ impl<'a, F: PrimeField, G: GroupType> Compiler<'a, F, G> { main_file_path: PathBuf, output_directory: PathBuf, context: AsgContext<'a>, + options: Option, ) -> Self { Self { program_name: package_name.clone(), @@ -92,7 +93,7 @@ impl<'a, F: PrimeField, G: GroupType> Compiler<'a, F, G> { program_input: Input::new(), asg: None, context, - options: CompilerOptions::default(), + options: options.unwrap_or(CompilerOptions::default()), file_contents: RefCell::new(IndexMap::new()), _engine: PhantomData, _group: PhantomData, @@ -111,8 +112,9 @@ impl<'a, F: PrimeField, G: GroupType> Compiler<'a, F, G> { main_file_path: PathBuf, output_directory: PathBuf, context: AsgContext<'a>, + options: Option, ) -> Result { - let mut compiler = Self::new(package_name, main_file_path, output_directory, context); + let mut compiler = Self::new(package_name, main_file_path, output_directory, context, options); compiler.parse_program()?; @@ -141,8 +143,9 @@ impl<'a, F: PrimeField, G: GroupType> Compiler<'a, F, G> { state_string: &str, state_path: &Path, context: AsgContext<'a>, + options: Option, ) -> Result { - let mut compiler = Self::new(package_name, main_file_path, output_directory, context); + let mut compiler = Self::new(package_name, main_file_path, output_directory, context, options); compiler.parse_input(input_string, input_path, state_string, state_path)?; diff --git a/compiler/tests/compiler/mod.rs b/compiler/tests/compiler/mod.rs index d07b11b69a..7d5a25ce01 100644 --- a/compiler/tests/compiler/mod.rs +++ b/compiler/tests/compiler/mod.rs @@ -28,7 +28,7 @@ fn test_parse_program_from_string() { // Parse program from string with compiler. let program_string = include_str!("main.leo"); let context = crate::make_test_context(); - let mut compiler_no_path = EdwardsTestCompiler::new("".to_string(), PathBuf::new(), PathBuf::new(), context); + let mut compiler_no_path = EdwardsTestCompiler::new("".to_string(), PathBuf::new(), PathBuf::new(), context, None); compiler_no_path.parse_program_from_string(program_string).unwrap(); @@ -37,7 +37,7 @@ fn test_parse_program_from_string() { local.push(MAIN_FILE_NAME); let compiler_with_path = - EdwardsTestCompiler::parse_program_without_input("".to_string(), local, PathBuf::new(), context).unwrap(); + EdwardsTestCompiler::parse_program_without_input("".to_string(), local, PathBuf::new(), context, None).unwrap(); // Compare output bytes. let expected_output = get_output(compiler_no_path); diff --git a/compiler/tests/mod.rs b/compiler/tests/mod.rs index 96069ffe54..fa9d2b7255 100644 --- a/compiler/tests/mod.rs +++ b/compiler/tests/mod.rs @@ -71,7 +71,7 @@ fn new_compiler() -> EdwardsTestCompiler { let path = PathBuf::from("/test/src/main.leo"); let output_dir = PathBuf::from(TEST_OUTPUT_DIRECTORY); - EdwardsTestCompiler::new(program_name, path, output_dir, make_test_context()) + EdwardsTestCompiler::new(program_name, path, output_dir, make_test_context(), None) } pub(crate) fn parse_program(program_string: &str) -> Result { diff --git a/leo/commands/build.rs b/leo/commands/build.rs index badfec2e15..5b70e9e2a2 100644 --- a/leo/commands/build.rs +++ b/leo/commands/build.rs @@ -81,6 +81,7 @@ impl Command for Build { lib_file_path, output_directory.clone(), thread_leaked_context(), + None, )?; tracing::info!("Complete"); }; @@ -114,6 +115,7 @@ impl Command for Build { &state_string, &state_path, thread_leaked_context(), + None, )?; // Compute the current program checksum diff --git a/leo/commands/test.rs b/leo/commands/test.rs index f5de8672f2..1bb140800d 100644 --- a/leo/commands/test.rs +++ b/leo/commands/test.rs @@ -107,6 +107,7 @@ impl Command for Test { file_path, output_directory.clone(), thread_leaked_context(), + None, )?; let temporary_program = program;