fix: WIP
This commit is contained in:
@@ -12,24 +12,61 @@
|
||||
use rnix::ast;
|
||||
|
||||
use derive_more::TryUnwrap;
|
||||
use hashbrown::HashMap;
|
||||
use hashbrown::{HashMap, HashSet};
|
||||
|
||||
use nixjit_value::Const as PubConst;
|
||||
|
||||
/// A type-safe wrapper for an index into an expression table.
|
||||
#[repr(transparent)]
|
||||
#[derive(Debug, Clone, Copy)]
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
|
||||
pub struct ExprId(usize);
|
||||
|
||||
impl From<usize> for ExprId {
|
||||
fn from(id: usize) -> Self {
|
||||
ExprId(id)
|
||||
}
|
||||
}
|
||||
|
||||
impl From<ExprId> for usize {
|
||||
fn from(id: ExprId) -> Self {
|
||||
id.0
|
||||
}
|
||||
}
|
||||
|
||||
/// A type-safe wrapper for an index into a function table.
|
||||
#[repr(transparent)]
|
||||
#[derive(Debug, Clone, Copy)]
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
|
||||
pub struct FuncId(usize);
|
||||
|
||||
impl From<usize> for FuncId {
|
||||
fn from(id: usize) -> Self {
|
||||
FuncId(id)
|
||||
}
|
||||
}
|
||||
|
||||
impl From<FuncId> for usize {
|
||||
fn from(id: FuncId) -> Self {
|
||||
id.0
|
||||
}
|
||||
}
|
||||
|
||||
/// A type-safe wrapper for an index into a function's argument list.
|
||||
#[repr(transparent)]
|
||||
#[derive(Debug, Clone, Copy)]
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
|
||||
pub struct ArgIdx(usize);
|
||||
|
||||
impl From<usize> for ArgIdx {
|
||||
fn from(id: usize) -> Self {
|
||||
ArgIdx(id)
|
||||
}
|
||||
}
|
||||
|
||||
impl From<ArgIdx> for usize {
|
||||
fn from(id: ArgIdx) -> Self {
|
||||
id.0
|
||||
}
|
||||
}
|
||||
|
||||
/// Represents a Nix attribute set.
|
||||
#[derive(Debug, Default)]
|
||||
pub struct AttrSet {
|
||||
@@ -185,7 +222,7 @@ pub struct Func {
|
||||
pub struct Param {
|
||||
pub ident: Option<String>,
|
||||
pub required: Option<Vec<String>>,
|
||||
pub allowed: Option<Vec<String>>,
|
||||
pub allowed: Option<HashSet<String>>,
|
||||
}
|
||||
|
||||
/// Represents a function call.
|
||||
|
||||
Reference in New Issue
Block a user