git.delta.rocks / jrsonnet / refs/commits / 66efc479cfa0

difftreelog

fix `Intrinsic` typo leftovers

Lach2020-08-23parent: #b04b14f.patch.diff
in: master

5 files changed

modifiedcrates/jrsonnet-evaluator/README.mddiffbeforeafterboth
31test tests::bench_parse ... bench: 7,206,164 ns/iter (+/- 1,067,418)31test tests::bench_parse ... bench: 7,206,164 ns/iter (+/- 1,067,418)
32```32```
3333
34## Intristics34## Intrinsics
3535
36Some functions from stdlib are implemented as intristics36Some functions from stdlib are implemented as intrinsics
3737
38### Intristic handling38### Intrinsic handling
3939
40If indexed jsonnet object has field '__intristic_namespace__' of type 'string', then any not found field/method is resolved as `Val::Intristic(__intristic_namespace__, name)`40If indexed jsonnet object has field '__intrinsic_namespace__' of type 'string', then any not found field/method is resolved as `Val::Intrinsic(__intrinsic_namespace__, name)`
4141
modifiedcrates/jrsonnet-evaluator/src/builtin/mod.rsdiffbeforeafterboth
--- a/crates/jrsonnet-evaluator/src/builtin/mod.rs
+++ b/crates/jrsonnet-evaluator/src/builtin/mod.rs
@@ -349,6 +349,6 @@
 		], {
 			Ok(v)
 		})?,
-		(ns, name) => throw!(IntristicNotFound(ns.into(), name.into())),
+		(ns, name) => throw!(IntrinsicNotFound(ns.into(), name.into())),
 	})
 }
modifiedcrates/jrsonnet-evaluator/src/evaluate.rsdiffbeforeafterboth
--- a/crates/jrsonnet-evaluator/src/evaluate.rs
+++ b/crates/jrsonnet-evaluator/src/evaluate.rs
@@ -467,9 +467,9 @@
 							if let Some(v) = v.get(s.clone())? {
 								Ok(v.unwrap_if_lazy()?)
 							} else if let Some(Val::Str(n)) =
-								v.get("__intristic_namespace__".into())?
+								v.get("__intrinsic_namespace__".into())?
 							{
-								Ok(Val::Func(Rc::new(FuncVal::Intristic(n, s))))
+								Ok(Val::Func(Rc::new(FuncVal::Intrinsic(n, s))))
 							} else {
 								throw!(NoSuchField(s))
 							}
modifiedcrates/jrsonnet-evaluator/src/val.rsdiffbeforeafterboth
--- a/crates/jrsonnet-evaluator/src/val.rs
+++ b/crates/jrsonnet-evaluator/src/val.rs
@@ -76,7 +76,7 @@
 	/// Plain function implemented in jsonnet
 	Normal(FuncDesc),
 	/// Standard library function
-	Intristic(Rc<str>, Rc<str>),
+	Intrinsic(Rc<str>, Rc<str>),
 	/// Library functions implemented in native
 	NativeExt(Rc<str>, Rc<NativeCallback>),
 }
@@ -85,7 +85,7 @@
 	fn eq(&self, other: &Self) -> bool {
 		match (self, other) {
 			(FuncVal::Normal(a), FuncVal::Normal(b)) => a == b,
-			(FuncVal::Intristic(ans, an), FuncVal::Intristic(bns, bn)) => ans == bns && an == bn,
+			(FuncVal::Intrinsic(ans, an), FuncVal::Intrinsic(bns, bn)) => ans == bns && an == bn,
 			(FuncVal::NativeExt(an, _), FuncVal::NativeExt(bn, _)) => an == bn,
 			(..) => false,
 		}
@@ -93,12 +93,12 @@
 }
 impl FuncVal {
 	pub fn is_ident(&self) -> bool {
-		matches!(&self, FuncVal::Intristic(ns, n) if ns as &str == "std" && n as &str == "id")
+		matches!(&self, FuncVal::Intrinsic(ns, n) if ns as &str == "std" && n as &str == "id")
 	}
 	pub fn name(&self) -> Rc<str> {
 		match self {
 			FuncVal::Normal(normal) => normal.name.clone(),
-			FuncVal::Intristic(ns, name) => format!("intristic.{}.{}", ns, name).into(),
+			FuncVal::Intrinsic(ns, name) => format!("intrinsic.{}.{}", ns, name).into(),
 			FuncVal::NativeExt(n, _) => format!("native.{}", n).into(),
 		}
 	}
@@ -120,7 +120,7 @@
 				)?;
 				evaluate(ctx, &func.body)
 			}
-			FuncVal::Intristic(ns, name) => call_builtin(call_ctx, loc, &ns, &name, args),
+			FuncVal::Intrinsic(ns, name) => call_builtin(call_ctx, loc, &ns, &name, args),
 			FuncVal::NativeExt(_name, handler) => {
 				let args = parse_function_call(call_ctx, None, &handler.params, args, true)?;
 				let mut out_args = Vec::with_capacity(handler.params.len());
@@ -149,7 +149,7 @@
 				)?;
 				evaluate(ctx, &func.body)
 			}
-			FuncVal::Intristic(_, _) => todo!(),
+			FuncVal::Intrinsic(_, _) => todo!(),
 			FuncVal::NativeExt(_, _) => todo!(),
 		}
 	}
@@ -160,7 +160,7 @@
 				let ctx = place_args(call_ctx, Some(func.ctx.clone()), &func.params, args)?;
 				evaluate(ctx, &func.body)
 			}
-			FuncVal::Intristic(_, _) => todo!(),
+			FuncVal::Intrinsic(_, _) => todo!(),
 			FuncVal::NativeExt(_, _) => todo!(),
 		}
 	}
modifiedcrates/jrsonnet-stdlib/src/std.jsonnetdiffbeforeafterboth
--- a/crates/jrsonnet-stdlib/src/std.jsonnet
+++ b/crates/jrsonnet-stdlib/src/std.jsonnet
@@ -1,5 +1,5 @@
 {
-  __intristic_namespace__:: 'std',
+  __intrinsic_namespace__:: 'std',
 
   local std = self,
   local id = std.id,