Fix no_index build.
This commit is contained in:
parent
b90776911d
commit
7ce8887343
@ -338,6 +338,7 @@ impl ChainArgument {
|
|||||||
/// Return the [position][Position].
|
/// Return the [position][Position].
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
#[must_use]
|
#[must_use]
|
||||||
|
#[allow(dead_code)]
|
||||||
pub const fn position(&self) -> Position {
|
pub const fn position(&self) -> Position {
|
||||||
match self {
|
match self {
|
||||||
#[cfg(not(feature = "no_object"))]
|
#[cfg(not(feature = "no_object"))]
|
||||||
|
@ -224,25 +224,32 @@ fn test_get_set_chain_without_write_back() -> Result<(), Box<EvalAltResult>> {
|
|||||||
"inner",
|
"inner",
|
||||||
|t: &mut Outer| t.inner.clone(),
|
|t: &mut Outer| t.inner.clone(),
|
||||||
|_: &mut Outer, new: Inner| panic!("Outer::inner setter called with {:?}", new),
|
|_: &mut Outer, new: Inner| panic!("Outer::inner setter called with {:?}", new),
|
||||||
)
|
|
||||||
.register_indexer_get_set(
|
|
||||||
|t: &mut Outer, n: INT| Inner {
|
|
||||||
value: t.inner.value * n,
|
|
||||||
},
|
|
||||||
|_: &mut Outer, n: INT, new: Inner| {
|
|
||||||
panic!("Outer::inner index setter called with {} and {:?}", n, new)
|
|
||||||
},
|
|
||||||
);
|
);
|
||||||
|
|
||||||
|
#[cfg(not(feature = "no_index"))]
|
||||||
|
engine.register_indexer_get_set(
|
||||||
|
|t: &mut Outer, n: INT| Inner {
|
||||||
|
value: t.inner.value * n,
|
||||||
|
},
|
||||||
|
|_: &mut Outer, n: INT, new: Inner| {
|
||||||
|
panic!("Outer::inner index setter called with {} and {:?}", n, new)
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
engine.eval_with_scope::<INT>(&mut scope, "outer.inner.value")?,
|
engine.eval_with_scope::<INT>(&mut scope, "outer.inner.value")?,
|
||||||
42
|
42
|
||||||
);
|
);
|
||||||
|
|
||||||
|
#[cfg(not(feature = "no_index"))]
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
engine.eval_with_scope::<INT>(&mut scope, "outer[2].value")?,
|
engine.eval_with_scope::<INT>(&mut scope, "outer[2].value")?,
|
||||||
84
|
84
|
||||||
);
|
);
|
||||||
|
|
||||||
engine.consume_with_scope(&mut scope, "print(outer.inner.value)")?;
|
engine.consume_with_scope(&mut scope, "print(outer.inner.value)")?;
|
||||||
|
|
||||||
|
#[cfg(not(feature = "no_index"))]
|
||||||
engine.consume_with_scope(&mut scope, "print(outer[0].value)")?;
|
engine.consume_with_scope(&mut scope, "print(outer[0].value)")?;
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
|
Loading…
x
Reference in New Issue
Block a user