difftreelog
style rename bindable -> unbound
in: master
4 files changed
crates/jrsonnet-evaluator/src/evaluate/mod.rsdiffbeforeafterboth--- a/crates/jrsonnet-evaluator/src/evaluate/mod.rs
+++ b/crates/jrsonnet-evaluator/src/evaluate/mod.rs
@@ -3,8 +3,8 @@
use gcmodule::{Cc, Trace};
use jrsonnet_interner::IStr;
use jrsonnet_parser::{
- ArgsDesc, AssertStmt, BindSpec, CompSpec, Expr, FieldMember, ForSpecData, IfSpecData,
- LiteralType, LocExpr, Member, ObjBody, ParamsDesc,
+ ArgsDesc, AssertStmt, BindSpec, CompSpec, Expr, FieldMember, FieldName, ForSpecData,
+ IfSpecData, LiteralType, LocExpr, Member, ObjBody, ParamsDesc,
};
use jrsonnet_types::ValType;
@@ -16,9 +16,9 @@
stdlib::{std_slice, BUILTINS},
tb, throw,
typed::Typed,
- val::{ArrValue, CachedBindable, Thunk, ThunkValue},
- Bindable, Context, GcHashMap, ObjValue, ObjValueBuilder, ObjectAssertion, Pending, Result,
- State, Val,
+ val::{ArrValue, CachedUnbound, Thunk, ThunkValue},
+ Context, GcHashMap, ObjValue, ObjValueBuilder, ObjectAssertion, Pending, Result, State,
+ Unbound, Val,
};
pub mod destructure;
pub mod operator;
@@ -32,14 +32,10 @@
})))
}
-pub fn evaluate_field_name(
- s: State,
- ctx: Context,
- field_name: &jrsonnet_parser::FieldName,
-) -> Result<Option<IStr>> {
+pub fn evaluate_field_name(s: State, ctx: Context, field_name: &FieldName) -> Result<Option<IStr>> {
Ok(match field_name {
- jrsonnet_parser::FieldName::Fixed(n) => Some(n.clone()),
- jrsonnet_parser::FieldName::Dyn(expr) => s.push(
+ FieldName::Fixed(n) => Some(n.clone()),
+ FieldName::Dyn(expr) => s.push(
CallLocation::new(&expr.1),
|| "evaluating field name".to_string(),
|| {
@@ -86,19 +82,19 @@
Ok(())
}
-trait CloneableBindable<T>: Bindable<Bound = T> + Clone {}
+trait CloneableUnbound<T>: Unbound<Bound = T> + Clone {}
fn evaluate_object_locals(
fctx: Pending<Context>,
locals: Rc<Vec<BindSpec>>,
-) -> impl CloneableBindable<Context> {
+) -> impl CloneableUnbound<Context> {
#[derive(Trace, Clone)]
- struct WithObjectLocals {
+ struct UnboundLocals {
fctx: Pending<Context>,
locals: Rc<Vec<BindSpec>>,
}
- impl CloneableBindable<Context> for WithObjectLocals {}
- impl Bindable for WithObjectLocals {
+ impl CloneableUnbound<Context> for UnboundLocals {}
+ impl Unbound for UnboundLocals {
type Bound = Context;
fn bind(
@@ -124,7 +120,7 @@
}
}
- WithObjectLocals { fctx, locals }
+ UnboundLocals { fctx, locals }
}
#[allow(clippy::too_many_lines)]
@@ -143,7 +139,7 @@
let fctx = Context::new_future();
// We have single context for all fields, so we can cache binds
- let uctx = CachedBindable::new(evaluate_object_locals(fctx.clone(), locals));
+ let uctx = CachedUnbound::new(evaluate_object_locals(fctx.clone(), locals));
for member in members.iter() {
match member {
@@ -155,12 +151,12 @@
value,
}) => {
#[derive(Trace)]
- struct ObjMemberBinding<B> {
+ struct UnboundValue<B> {
uctx: B,
value: LocExpr,
name: IStr,
}
- impl<B: Bindable<Bound = Context>> Bindable for ObjMemberBinding<B> {
+ impl<B: Unbound<Bound = Context>> Unbound for UnboundValue<B> {
type Bound = Thunk<Val>;
fn bind(
&self,
@@ -191,7 +187,7 @@
.with_location(value.1.clone())
.bindable(
s.clone(),
- tb!(ObjMemberBinding {
+ tb!(UnboundValue {
uctx: uctx.clone(),
value: value.clone(),
name: name.clone()
@@ -205,13 +201,13 @@
..
}) => {
#[derive(Trace)]
- struct ObjMemberBinding<B> {
+ struct UnboundMethod<B> {
uctx: B,
value: LocExpr,
params: ParamsDesc,
name: IStr,
}
- impl<B: Bindable<Bound = Context>> Bindable for ObjMemberBinding<B> {
+ impl<B: Unbound<Bound = Context>> Unbound for UnboundMethod<B> {
type Bound = Thunk<Val>;
fn bind(
&self,
@@ -240,7 +236,7 @@
.with_location(value.1.clone())
.bindable(
s.clone(),
- tb!(ObjMemberBinding {
+ tb!(UnboundMethod {
uctx: uctx.clone(),
value: value.clone(),
params: params.clone(),
@@ -255,7 +251,7 @@
uctx: B,
assert: AssertStmt,
}
- impl<B: Bindable<Bound = Context>> ObjectAssertion for ObjectAssert<B> {
+ impl<B: Unbound<Bound = Context>> ObjectAssertion for ObjectAssert<B> {
fn run(
&self,
s: State,
@@ -303,11 +299,11 @@
Val::Null => {}
Val::Str(n) => {
#[derive(Trace)]
- struct ObjCompBinding<B> {
+ struct UnboundValue<B> {
uctx: B,
value: LocExpr,
}
- impl<B: Bindable<Bound = Context>> Bindable for ObjCompBinding<B> {
+ impl<B: Unbound<Bound = Context>> Unbound for UnboundValue<B> {
type Bound = Thunk<Val>;
fn bind(
&self,
@@ -333,7 +329,7 @@
.with_add(obj.plus)
.bindable(
s.clone(),
- tb!(ObjCompBinding {
+ tb!(UnboundValue {
uctx,
value: obj.value.clone(),
}),
crates/jrsonnet-evaluator/src/lib.rsdiffbeforeafterboth--- a/crates/jrsonnet-evaluator/src/lib.rs
+++ b/crates/jrsonnet-evaluator/src/lib.rs
@@ -60,14 +60,14 @@
use trace::{location_to_offset, offset_to_location, CodeLocation, CompactFormat, TraceFormat};
pub use val::{ManifestFormat, Thunk, Val};
-pub trait Bindable: Trace + 'static {
+pub trait Unbound: Trace {
type Bound;
fn bind(&self, s: State, sup: Option<ObjValue>, this: Option<ObjValue>) -> Result<Self::Bound>;
}
#[derive(Clone, Trace)]
pub enum LazyBinding {
- Bindable(Cc<TraceBox<dyn Bindable<Bound = Thunk<Val>>>>),
+ Bindable(Cc<TraceBox<dyn Unbound<Bound = Thunk<Val>>>>),
Bound(Thunk<Val>),
}
crates/jrsonnet-evaluator/src/obj.rsdiffbeforeafterboth--- a/crates/jrsonnet-evaluator/src/obj.rs
+++ b/crates/jrsonnet-evaluator/src/obj.rs
@@ -16,7 +16,7 @@
function::CallLocation,
gc::{GcHashMap, GcHashSet, TraceBox},
operator::evaluate_add_op,
- throw, weak_ptr_eq, weak_raw, Bindable, LazyBinding, Result, State, Thunk, Val,
+ throw, weak_ptr_eq, weak_raw, LazyBinding, Result, State, Thunk, Unbound, Val,
};
#[cfg(not(feature = "exp-preserve-order"))]
@@ -589,7 +589,7 @@
pub fn bindable(
self,
s: State,
- bindable: TraceBox<dyn Bindable<Bound = Thunk<Val>>>,
+ bindable: TraceBox<dyn Unbound<Bound = Thunk<Val>>>,
) -> Result<()> {
self.binding(s, LazyBinding::Bindable(Cc::new(bindable)))
}
@@ -613,7 +613,7 @@
pub fn value(self, value: Val) {
self.binding(LazyBinding::Bound(Thunk::evaluated(value)));
}
- pub fn bindable(self, bindable: TraceBox<dyn Bindable<Bound = Thunk<Val>>>) {
+ pub fn bindable(self, bindable: TraceBox<dyn Unbound<Bound = Thunk<Val>>>) {
self.binding(LazyBinding::Bindable(Cc::new(bindable)));
}
pub fn binding(self, binding: LazyBinding) {
crates/jrsonnet-evaluator/src/val.rsdiffbeforeafterboth12 stdlib::manifest::{12 stdlib::manifest::{13 manifest_json_ex, manifest_yaml_ex, ManifestJsonOptions, ManifestType, ManifestYamlOptions,13 manifest_json_ex, manifest_yaml_ex, ManifestJsonOptions, ManifestType, ManifestYamlOptions,14 },14 },15 throw, Bindable, ObjValue, Result, State, WeakObjValue,15 throw, ObjValue, Result, State, Unbound, WeakObjValue,16};16};171718pub trait ThunkValue: Trace {18pub trait ThunkValue: Trace {74type CacheKey = (Option<WeakObjValue>, Option<WeakObjValue>);74type CacheKey = (Option<WeakObjValue>, Option<WeakObjValue>);757576#[derive(Trace, Clone)]76#[derive(Trace, Clone)]77pub struct CachedBindable<I, T>77pub struct CachedUnbound<I, T>78where78where79 I: Bindable<Bound = T>,79 I: Unbound<Bound = T>,80{80{81 cache: Cc<RefCell<GcHashMap<CacheKey, T>>>,81 cache: Cc<RefCell<GcHashMap<CacheKey, T>>>,82 value: I,82 value: I,83}83}84impl<I: Bindable<Bound = T>, T: Trace> CachedBindable<I, T> {84impl<I: Unbound<Bound = T>, T: Trace> CachedUnbound<I, T> {85 pub fn new(value: I) -> Self {85 pub fn new(value: I) -> Self {86 Self {86 Self {87 cache: Cc::new(RefCell::new(GcHashMap::new())),87 cache: Cc::new(RefCell::new(GcHashMap::new())),88 value,88 value,89 }89 }90 }90 }91}91}92impl<I: Bindable<Bound = T>, T: Clone + Trace> Bindable for CachedBindable<I, T> {92impl<I: Unbound<Bound = T>, T: Clone + Trace> Unbound for CachedUnbound<I, T> {93 type Bound = T;93 type Bound = T;94 fn bind(&self, s: State, sup: Option<ObjValue>, this: Option<ObjValue>) -> Result<T> {94 fn bind(&self, s: State, sup: Option<ObjValue>, this: Option<ObjValue>) -> Result<T> {95 let cache_key = (95 let cache_key = (