mirror of
https://github.com/pezkuwichain/revive.git
synced 2026-06-14 01:51:03 +00:00
Make wasm version to compile
This commit is contained in:
@@ -33,7 +33,7 @@ pub struct WorkerProcess;
|
|||||||
|
|
||||||
impl Process for WorkerProcess {
|
impl Process for WorkerProcess {
|
||||||
/// Read input from `stdin`, compile a contract, and write the output to `stdout`.
|
/// Read input from `stdin`, compile a contract, and write the output to `stdout`.
|
||||||
fn run() -> anyhow::Result<()> {
|
fn run(input_file: Option<&mut std::fs::File>) -> anyhow::Result<()> {
|
||||||
let mut buffer = Vec::with_capacity(16384);
|
let mut buffer = Vec::with_capacity(16384);
|
||||||
// TODO: Init correctly stdin in emscripten - preload FS conf before module init
|
// TODO: Init correctly stdin in emscripten - preload FS conf before module init
|
||||||
let mut stdin = File::open("/in")
|
let mut stdin = File::open("/in")
|
||||||
@@ -43,16 +43,26 @@ impl Process for WorkerProcess {
|
|||||||
let mut stderr = File::create("/err")
|
let mut stderr = File::create("/err")
|
||||||
.map_err(|error| anyhow::anyhow!("File /err creating error: {}", error))?;
|
.map_err(|error| anyhow::anyhow!("File /err creating error: {}", error))?;
|
||||||
|
|
||||||
stdin.read_to_end(&mut buffer).expect("Stdin reading error");
|
match input_file {
|
||||||
|
Some(ins) => {
|
||||||
|
if let Err(error) = ins.read_to_end(&mut buffer) {
|
||||||
|
anyhow::bail!("Failed to read recursive process input file: {:?}", error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
None => {
|
||||||
|
if let Err(error) = stdin.read_to_end(&mut buffer) {
|
||||||
|
anyhow::bail!(
|
||||||
|
"Failed to read recursive process input from stdin: {:?}",
|
||||||
|
error
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
let input: Input = revive_common::deserialize_from_slice(buffer.as_slice())?;
|
let input: Input = revive_common::deserialize_from_slice(buffer.as_slice())?;
|
||||||
if input.enable_test_encoding {
|
|
||||||
todo!()
|
|
||||||
}
|
|
||||||
let result = input.contract.compile(
|
let result = input.contract.compile(
|
||||||
input.project,
|
input.project,
|
||||||
input.optimizer_settings,
|
input.optimizer_settings,
|
||||||
input.is_system_mode,
|
|
||||||
input.include_metadata_hash,
|
input.include_metadata_hash,
|
||||||
input.debug_config,
|
input.debug_config,
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -77,7 +77,6 @@ impl Compiler for SoljsonCompiler {
|
|||||||
)
|
)
|
||||||
})?;
|
})?;
|
||||||
output.preprocess_ast(&version, pipeline, suppressed_warnings.as_slice())?;
|
output.preprocess_ast(&version, pipeline, suppressed_warnings.as_slice())?;
|
||||||
output.remove_evm();
|
|
||||||
|
|
||||||
Ok(output)
|
Ok(output)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user