Skip to content

Commit

Permalink
Split execution code (#111)
Browse files Browse the repository at this point in the history
  • Loading branch information
arduano authored Mar 23, 2024
1 parent a6c74bd commit f55aee2
Show file tree
Hide file tree
Showing 11 changed files with 1,342 additions and 1,326 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,5 +60,5 @@ jobs:
set -x
cargo fmt --check
cargo clippy
cargo clippy -- --deny "warnings"
cargo test
1 change: 0 additions & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
buildInputs = rix-deps ++ nixjs-rt-deps;
shellHook = ''
export RIX_NIXRT_JS_MODULE=nixjs-rt/dist/lib.mjs
export RUSTFLAGS=-Dwarnings
'';
};
});
Expand Down
4 changes: 2 additions & 2 deletions src/cmd/eval.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use std::collections::HashMap;

use crate::cmd::{to_cmd_err, RixSubCommand};
use crate::eval::nix_v8;
use crate::eval::execution;
use crate::eval::types::Value;
use clap::{Arg, ArgAction, ArgMatches};

Expand All @@ -27,7 +27,7 @@ pub fn handle_cmd(parsed_args: &ArgMatches) -> Result<(), String> {
let expr = parsed_args
.get_one::<String>("expr")
.ok_or("You must use the '--expr' option. Nothing else is implemented :)")?;
print_value(&nix_v8::evaluate(expr)?);
print_value(&execution::evaluate(expr)?);
println!();
Ok(())
}
Expand Down
4 changes: 2 additions & 2 deletions src/cmd/transpile.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use crate::cmd::{to_cmd_err, RixSubCommand};
use crate::eval::nix_v8;
use crate::eval::emit_js;
use clap::{Arg, ArgAction, ArgMatches};

pub fn cmd() -> RixSubCommand {
Expand All @@ -26,7 +26,7 @@ pub fn handle_cmd(parsed_args: &ArgMatches) -> Result<(), String> {
.ok_or("You must provide a single expression to transpile.")?;
let is_expression = parsed_args.get_one::<bool>("expr").unwrap();
if *is_expression {
let js_source = nix_v8::emit_module(expression)
let js_source = emit_js::emit_module(expression)
.map_err(|_err| "Failed to transpile the expression.".to_owned())?;
print!("{js_source}");
} else {
Expand Down
Loading

0 comments on commit f55aee2

Please sign in to comment.