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
--- a/crates/jrsonnet-evaluator/README.md
+++ b/crates/jrsonnet-evaluator/README.md
@@ -31,10 +31,10 @@
 test tests::bench_parse     ... bench:   7,206,164 ns/iter (+/- 1,067,418)
 ```
 
-## Intristics
+## Intrinsics
 
-Some functions from stdlib are implemented as intristics
+Some functions from stdlib are implemented as intrinsics
 
-### Intristic handling
+### Intrinsic handling
 
-If indexed jsonnet object has field '__intristic_namespace__' of type 'string', then any not found field/method is resolved as `Val::Intristic(__intristic_namespace__, name)`
+If indexed jsonnet object has field '__intrinsic_namespace__' of type 'string', then any not found field/method is resolved as `Val::Intrinsic(__intrinsic_namespace__, name)`
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
76 /// Plain function implemented in jsonnet76 /// Plain function implemented in jsonnet
77 Normal(FuncDesc),77 Normal(FuncDesc),
78 /// Standard library function78 /// Standard library function
79 Intristic(Rc<str>, Rc<str>),79 Intrinsic(Rc<str>, Rc<str>),
80 /// Library functions implemented in native80 /// Library functions implemented in native
81 NativeExt(Rc<str>, Rc<NativeCallback>),81 NativeExt(Rc<str>, Rc<NativeCallback>),
82}82}
85 fn eq(&self, other: &Self) -> bool {85 fn eq(&self, other: &Self) -> bool {
86 match (self, other) {86 match (self, other) {
87 (FuncVal::Normal(a), FuncVal::Normal(b)) => a == b,87 (FuncVal::Normal(a), FuncVal::Normal(b)) => a == b,
88 (FuncVal::Intristic(ans, an), FuncVal::Intristic(bns, bn)) => ans == bns && an == bn,88 (FuncVal::Intrinsic(ans, an), FuncVal::Intrinsic(bns, bn)) => ans == bns && an == bn,
89 (FuncVal::NativeExt(an, _), FuncVal::NativeExt(bn, _)) => an == bn,89 (FuncVal::NativeExt(an, _), FuncVal::NativeExt(bn, _)) => an == bn,
90 (..) => false,90 (..) => false,
91 }91 }
92 }92 }
93}93}
94impl FuncVal {94impl FuncVal {
95 pub fn is_ident(&self) -> bool {95 pub fn is_ident(&self) -> bool {
96 matches!(&self, FuncVal::Intristic(ns, n) if ns as &str == "std" && n as &str == "id")96 matches!(&self, FuncVal::Intrinsic(ns, n) if ns as &str == "std" && n as &str == "id")
97 }97 }
98 pub fn name(&self) -> Rc<str> {98 pub fn name(&self) -> Rc<str> {
99 match self {99 match self {
100 FuncVal::Normal(normal) => normal.name.clone(),100 FuncVal::Normal(normal) => normal.name.clone(),
101 FuncVal::Intristic(ns, name) => format!("intristic.{}.{}", ns, name).into(),101 FuncVal::Intrinsic(ns, name) => format!("intrinsic.{}.{}", ns, name).into(),
102 FuncVal::NativeExt(n, _) => format!("native.{}", n).into(),102 FuncVal::NativeExt(n, _) => format!("native.{}", n).into(),
103 }103 }
104 }104 }
120 )?;120 )?;
121 evaluate(ctx, &func.body)121 evaluate(ctx, &func.body)
122 }122 }
123 FuncVal::Intristic(ns, name) => call_builtin(call_ctx, loc, &ns, &name, args),123 FuncVal::Intrinsic(ns, name) => call_builtin(call_ctx, loc, &ns, &name, args),
124 FuncVal::NativeExt(_name, handler) => {124 FuncVal::NativeExt(_name, handler) => {
125 let args = parse_function_call(call_ctx, None, &handler.params, args, true)?;125 let args = parse_function_call(call_ctx, None, &handler.params, args, true)?;
126 let mut out_args = Vec::with_capacity(handler.params.len());126 let mut out_args = Vec::with_capacity(handler.params.len());
149 )?;149 )?;
150 evaluate(ctx, &func.body)150 evaluate(ctx, &func.body)
151 }151 }
152 FuncVal::Intristic(_, _) => todo!(),152 FuncVal::Intrinsic(_, _) => todo!(),
153 FuncVal::NativeExt(_, _) => todo!(),153 FuncVal::NativeExt(_, _) => todo!(),
154 }154 }
155 }155 }
160 let ctx = place_args(call_ctx, Some(func.ctx.clone()), &func.params, args)?;160 let ctx = place_args(call_ctx, Some(func.ctx.clone()), &func.params, args)?;
161 evaluate(ctx, &func.body)161 evaluate(ctx, &func.body)
162 }162 }
163 FuncVal::Intristic(_, _) => todo!(),163 FuncVal::Intrinsic(_, _) => todo!(),
164 FuncVal::NativeExt(_, _) => todo!(),164 FuncVal::NativeExt(_, _) => todo!(),
165 }165 }
166 }166 }
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,