Fix features.
This commit is contained in:
parent
7957c58def
commit
760c13d36e
@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "rhai"
|
||||
version = "0.16.0"
|
||||
version = "0.16.1"
|
||||
edition = "2018"
|
||||
authors = ["Jonathan Turner", "Lukáš Hozda", "Stephen Chung"]
|
||||
description = "Embedded scripting for Rust"
|
||||
|
10
RELEASES.md
10
RELEASES.md
@ -1,11 +1,21 @@
|
||||
Rhai Release Notes
|
||||
==================
|
||||
|
||||
Version 0.16.1
|
||||
==============
|
||||
|
||||
Bug fix release to fix errors when compiling with features.
|
||||
|
||||
|
||||
Version 0.16.0
|
||||
==============
|
||||
|
||||
The major new feature in this version is OOP - well, poor man's OOP, that is.
|
||||
|
||||
The `README` is officially transferred to [The Rhai Book](https://schungx.github.io/rhai).
|
||||
|
||||
An online [Playground](https://alvinhochun.github.io/rhai-demo/) is available.
|
||||
|
||||
Breaking changes
|
||||
----------------
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
{
|
||||
"version": "0.16.0",
|
||||
"version": "0.16.1",
|
||||
"rootUrl": "",
|
||||
"rootUrlX": "/rhai"
|
||||
}
|
@ -2407,7 +2407,13 @@ impl Engine {
|
||||
let mut maps = 0;
|
||||
|
||||
arr.iter().for_each(|value| match value {
|
||||
Dynamic(Union::Array(_)) | Dynamic(Union::Map(_)) => {
|
||||
Dynamic(Union::Array(_)) => {
|
||||
let (a, m, _) = calc_size(value);
|
||||
arrays += a;
|
||||
maps += m;
|
||||
}
|
||||
#[cfg(not(feature = "no_object"))]
|
||||
Dynamic(Union::Map(_)) => {
|
||||
let (a, m, _) = calc_size(value);
|
||||
arrays += a;
|
||||
maps += m;
|
||||
@ -2423,7 +2429,13 @@ impl Engine {
|
||||
let mut maps = 0;
|
||||
|
||||
map.values().for_each(|value| match value {
|
||||
Dynamic(Union::Array(_)) | Dynamic(Union::Map(_)) => {
|
||||
#[cfg(not(feature = "no_index"))]
|
||||
Dynamic(Union::Array(_)) => {
|
||||
let (a, m, _) = calc_size(value);
|
||||
arrays += a;
|
||||
maps += m;
|
||||
}
|
||||
Dynamic(Union::Map(_)) => {
|
||||
let (a, m, _) = calc_size(value);
|
||||
arrays += a;
|
||||
maps += m;
|
||||
|
@ -3,6 +3,7 @@ use crate::fn_native::FnPtr;
|
||||
|
||||
def_package!(crate:BasicFnPackage:"Basic Fn functions.", lib, {
|
||||
lib.set_fn_1_mut("name", |f: &mut FnPtr| Ok(f.get_fn_name().clone()));
|
||||
lib.set_getter_fn("name", |f: &mut FnPtr| Ok(f.get_fn_name().clone()));
|
||||
|
||||
#[cfg(not(feature = "no_object"))]
|
||||
lib.set_getter_fn("name", |f: &mut FnPtr| Ok(f.get_fn_name().clone()));
|
||||
});
|
||||
|
@ -2194,6 +2194,7 @@ fn parse_let(
|
||||
}
|
||||
|
||||
/// Parse an import statement.
|
||||
#[cfg(not(feature = "no_module"))]
|
||||
fn parse_import(
|
||||
input: &mut TokenStream,
|
||||
state: &mut ParseState,
|
||||
@ -2444,6 +2445,8 @@ fn parse_stmt(
|
||||
|
||||
Token::Let => parse_let(input, state, Normal, settings.level_up()),
|
||||
Token::Const => parse_let(input, state, Constant, settings.level_up()),
|
||||
|
||||
#[cfg(not(feature = "no_module"))]
|
||||
Token::Import => parse_import(input, state, settings.level_up()),
|
||||
|
||||
#[cfg(not(feature = "no_module"))]
|
||||
|
@ -35,6 +35,7 @@ fn test_max_string_size() -> Result<(), Box<EvalAltResult>> {
|
||||
EvalAltResult::ErrorDataTooLarge(_, 10, 13, _)
|
||||
));
|
||||
|
||||
#[cfg(not(feature = "no_object"))]
|
||||
assert!(matches!(
|
||||
*engine
|
||||
.eval::<String>(
|
||||
@ -92,6 +93,8 @@ fn test_max_array_size() -> Result<(), Box<EvalAltResult>> {
|
||||
.expect_err("should error"),
|
||||
EvalAltResult::ErrorDataTooLarge(_, 10, 12, _)
|
||||
));
|
||||
|
||||
#[cfg(not(feature = "no_object"))]
|
||||
assert!(matches!(
|
||||
*engine
|
||||
.eval::<Array>(
|
||||
|
@ -39,7 +39,7 @@ fn test_for_string() -> Result<(), Box<EvalAltResult>> {
|
||||
let sum = 0;
|
||||
|
||||
for ch in s {
|
||||
sum += ch.to_int();
|
||||
sum += to_int(ch);
|
||||
}
|
||||
|
||||
sum
|
||||
|
@ -52,6 +52,7 @@ fn test_functions() -> Result<(), Box<EvalAltResult>> {
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[cfg(not(feature = "no_object"))]
|
||||
fn test_function_pointers() -> Result<(), Box<EvalAltResult>> {
|
||||
let engine = Engine::new();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user