Link libqjs
This commit is contained in:
+3
-21
@@ -3,11 +3,10 @@ mod declosure;
|
||||
mod demutate;
|
||||
mod flatten;
|
||||
mod infer;
|
||||
mod libqjs;
|
||||
mod parse;
|
||||
mod regify;
|
||||
|
||||
use std::process::Command;
|
||||
|
||||
use declass::declass;
|
||||
use declosure::declosure;
|
||||
use demutate::demutate;
|
||||
@@ -16,24 +15,15 @@ use infer::infer;
|
||||
use parse::QuickJSBinary;
|
||||
use regify::regify;
|
||||
|
||||
const QJSC: &str = "../third_party/quickjs/build/qjsc";
|
||||
const BIN_OUT: &str = "/tmp/qjsrt.bin";
|
||||
|
||||
fn main() {
|
||||
let args = std::env::args().collect::<Vec<String>>();
|
||||
let filename = args.get(1).unwrap();
|
||||
|
||||
// Compile source file
|
||||
let output = Command::new(QJSC)
|
||||
.args(["-b", "-o", BIN_OUT])
|
||||
.arg(filename)
|
||||
.output()
|
||||
.unwrap();
|
||||
|
||||
assert!(output.status.success());
|
||||
let source = std::fs::read_to_string(filename).unwrap();
|
||||
let bin = libqjs::compile(&source, filename).unwrap();
|
||||
|
||||
// Parse, then flatten
|
||||
let bin = std::fs::read(BIN_OUT).unwrap();
|
||||
let (_, parsed) = QuickJSBinary::parse(&bin).unwrap();
|
||||
let (flat_fns, atoms) = flatten(parsed);
|
||||
|
||||
@@ -65,12 +55,4 @@ fn main() {
|
||||
}
|
||||
|
||||
println!("{atoms:#?}");
|
||||
|
||||
/*println!("=== after deprototype ===");
|
||||
let deprototyped = deprototype(declassed);
|
||||
println!("{deprototyped:#?}");
|
||||
|
||||
println!("=== after declosure ===");
|
||||
let declosured = declosure(deprototyped);
|
||||
println!("{declosured:#?}");*/
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user