fix(tvix/eval): VM & Builtin* types have to be public
... without them, using the new Builtins API is basically impossible for library consumers. Change-Id: Ice0557a2e55e12d812f51bf5a99e6b8c91ad1b91 Reviewed-on: https://cl.tvl.fyi/c/depot/+/7755 Autosubmit: tazjin <tazjin@tvl.su> Reviewed-by: flokli <flokli@flokli.de> Tested-by: BuildkiteCI
This commit is contained in:
parent
5634172a7f
commit
88432235ae
2 changed files with 6 additions and 13 deletions
|
@ -167,7 +167,7 @@ pub fn builtins(_args: TokenStream, item: TokenStream) -> TokenStream {
|
||||||
};
|
};
|
||||||
|
|
||||||
Ok(quote_spanned!(arg.span() => {
|
Ok(quote_spanned!(arg.span() => {
|
||||||
crate::internal::BuiltinArgument {
|
crate::BuiltinArgument {
|
||||||
strict: #strict,
|
strict: #strict,
|
||||||
name: #name,
|
name: #name,
|
||||||
}
|
}
|
||||||
|
@ -194,11 +194,11 @@ pub fn builtins(_args: TokenStream, item: TokenStream) -> TokenStream {
|
||||||
};
|
};
|
||||||
|
|
||||||
builtins.push(quote_spanned! { builtin_attr.span() => {
|
builtins.push(quote_spanned! { builtin_attr.span() => {
|
||||||
crate::internal::Builtin::new(
|
crate::Builtin::new(
|
||||||
#name,
|
#name,
|
||||||
&[#(#builtin_arguments),*],
|
&[#(#builtin_arguments),*],
|
||||||
#docstring,
|
#docstring,
|
||||||
|mut args: Vec<crate::Value>, vm: &mut crate::internal::VM| {
|
|mut args: Vec<crate::Value>, vm: &mut crate::VM| {
|
||||||
#(let #reversed_args = args.pop().unwrap();)*
|
#(let #reversed_args = args.pop().unwrap();)*
|
||||||
#fn_name(vm, #(#args),*)
|
#fn_name(vm, #(#args),*)
|
||||||
}
|
}
|
||||||
|
@ -209,7 +209,7 @@ pub fn builtins(_args: TokenStream, item: TokenStream) -> TokenStream {
|
||||||
}
|
}
|
||||||
|
|
||||||
items.push(parse_quote! {
|
items.push(parse_quote! {
|
||||||
pub fn builtins() -> Vec<crate::internal::Builtin> {
|
pub fn builtins() -> Vec<crate::Builtin> {
|
||||||
vec![#(#builtins),*]
|
vec![#(#builtins),*]
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -47,20 +47,13 @@ pub use crate::io::{DummyIO, EvalIO, FileType};
|
||||||
use crate::observer::{CompilerObserver, RuntimeObserver};
|
use crate::observer::{CompilerObserver, RuntimeObserver};
|
||||||
pub use crate::pretty_ast::pretty_print_expr;
|
pub use crate::pretty_ast::pretty_print_expr;
|
||||||
pub use crate::source::SourceCode;
|
pub use crate::source::SourceCode;
|
||||||
pub use crate::value::{NixAttrs, NixList, NixString, Value};
|
pub use crate::value::{Builtin, BuiltinArgument, NixAttrs, NixList, NixString, Value};
|
||||||
pub use crate::vm::run_lambda;
|
pub use crate::vm::{run_lambda, VM};
|
||||||
pub use crate::warnings::{EvalWarning, WarningKind};
|
pub use crate::warnings::{EvalWarning, WarningKind};
|
||||||
|
|
||||||
#[cfg(feature = "impure")]
|
#[cfg(feature = "impure")]
|
||||||
pub use crate::io::StdIO;
|
pub use crate::io::StdIO;
|
||||||
|
|
||||||
/// Internal-only parts of `tvix-eval`, exported for use in macros, but not part of the public
|
|
||||||
/// interface of the crate.
|
|
||||||
pub mod internal {
|
|
||||||
pub use crate::value::{Builtin, BuiltinArgument};
|
|
||||||
pub use crate::vm::VM;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// An `Evaluation` represents how a piece of Nix code is evaluated. It can be
|
/// An `Evaluation` represents how a piece of Nix code is evaluated. It can be
|
||||||
/// instantiated and configured directly, or it can be accessed through the
|
/// instantiated and configured directly, or it can be accessed through the
|
||||||
/// various simplified helper methods available below.
|
/// various simplified helper methods available below.
|
||||||
|
|
Loading…
Add table
Reference in a new issue