Compare commits
1 Commits
main
...
112777e1b9
| Author | SHA1 | Date | |
|---|---|---|---|
|
112777e1b9
|
+3
-3
@@ -10,7 +10,7 @@ use rustyline::DefaultEditor;
|
||||
use rustyline::error::ReadlineError;
|
||||
|
||||
#[derive(Parser)]
|
||||
#[command(name = "nix-js", about = "Nix expression evaluator")]
|
||||
#[command(name = "fix", about = "Nix expression evaluator")]
|
||||
struct Cli {
|
||||
#[command(subcommand)]
|
||||
command: Command,
|
||||
@@ -40,8 +40,8 @@ struct ExprSource {
|
||||
file: Option<PathBuf>,
|
||||
}
|
||||
|
||||
fn run_compile(runtime: &mut Runtime, src: ExprSource, silent: bool) -> Result<()> {
|
||||
let src = if let Some(expr) = src.expr {
|
||||
fn run_compile(_runtime: &mut Runtime, src: ExprSource, _silent: bool) -> Result<()> {
|
||||
let _src = if let Some(expr) = src.expr {
|
||||
Source::new_eval(expr)?
|
||||
} else if let Some(file) = src.file {
|
||||
Source::new_file(file)?
|
||||
|
||||
+1
-1
@@ -109,7 +109,7 @@ impl Runtime {
|
||||
token,
|
||||
strings,
|
||||
source: sources.last().unwrap().clone(),
|
||||
scopes: [Scope::Global(global_env)].into_iter().chain(extra_scope.into_iter()).collect(),
|
||||
scopes: [Scope::Global(global_env)].into_iter().chain(extra_scope).collect(),
|
||||
with_scope_count: 0,
|
||||
arg_count: 0,
|
||||
thunk_count,
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -34,6 +34,13 @@ impl<const N: usize, T> Stack<N, T> {
|
||||
}
|
||||
}
|
||||
|
||||
pub(super) unsafe fn push_unchecked(&mut self, val: T) {
|
||||
unsafe {
|
||||
self.inner.get_unchecked_mut(self.len).write(val);
|
||||
}
|
||||
self.len += 1;
|
||||
}
|
||||
|
||||
pub(super) fn push(&mut self, val: T) -> Result<(), T> {
|
||||
if self.len == N {
|
||||
return Err(val);
|
||||
|
||||
+1458
-49
File diff suppressed because it is too large
Load Diff
@@ -7,7 +7,6 @@ mod validation;
|
||||
|
||||
pub use config::StoreConfig;
|
||||
pub use daemon::DaemonStore;
|
||||
pub use validation::validate_store_path;
|
||||
|
||||
pub trait Store: Send + Sync {
|
||||
fn get_store_dir(&self) -> &str;
|
||||
|
||||
@@ -267,6 +267,15 @@ fn escape_quote_string(s: &str) -> String {
|
||||
ret
|
||||
}
|
||||
|
||||
/// Wrapper to format a float in Nix style (C printf `%g` with precision 6).
|
||||
pub(crate) struct NixFloat(pub f64);
|
||||
|
||||
impl Display for NixFloat {
|
||||
fn fmt(&self, f: &mut Formatter<'_>) -> FmtResult {
|
||||
fmt_nix_float(f, self.0)
|
||||
}
|
||||
}
|
||||
|
||||
/// Format a float matching C's `printf("%g", x)` with default precision 6.
|
||||
fn fmt_nix_float(f: &mut Formatter<'_>, x: f64) -> FmtResult {
|
||||
if !x.is_finite() {
|
||||
|
||||
Reference in New Issue
Block a user