Fixup docs.
This commit is contained in:
parent
2e7ec8f1db
commit
2a7e6c0884
13
RELEASES.md
13
RELEASES.md
@ -1,6 +1,10 @@
|
|||||||
Rhai Release Notes
|
Rhai Release Notes
|
||||||
==================
|
==================
|
||||||
|
|
||||||
|
Version 0.19.9
|
||||||
|
==============
|
||||||
|
|
||||||
|
|
||||||
Version 0.19.8
|
Version 0.19.8
|
||||||
==============
|
==============
|
||||||
|
|
||||||
@ -14,13 +18,15 @@ A new API, `Engine::gen_fn_metadata_to_json` and `Engine::gen_fn_metadata_with_a
|
|||||||
paired with the new `metadata` feature, exports the full list of functions metadata
|
paired with the new `metadata` feature, exports the full list of functions metadata
|
||||||
(including those in an `AST`) as a JSON document.
|
(including those in an `AST`) as a JSON document.
|
||||||
|
|
||||||
|
There are also a sizable number of bug fixes.
|
||||||
|
|
||||||
Bug fixes
|
Bug fixes
|
||||||
---------
|
---------
|
||||||
|
|
||||||
* Unary prefix operators `-`, `+` and `!` now bind correctly when applied to an expression. Previously, `-x.len` is parsed as `(-x).len` which is obviously counter-intuitive.
|
* Unary prefix operators `-`, `+` and `!` now bind correctly when applied to an expression. Previously, `-x.len` is parsed as `(-x).len` which is obviously counter-intuitive.
|
||||||
* Indexing of namespace-qualified variables now work properly, such as `path::to::var[x]`.
|
* Indexing of namespace-qualified variables now work properly, such as `path::to::var[x]`.
|
||||||
* Constants are no longer propagated by the optimizer if shadowed by a non-constant variable.
|
* Constants are no longer propagated by the optimizer if shadowed by a non-constant variable.
|
||||||
* Constants passed as the `this` parameter to Rhai functions now throws an error if assigned to.
|
* A constant passed as the `this` parameter to Rhai functions now throws an error if assigned to.
|
||||||
* Generic type parameter of `Engine::register_iterator` is `IntoIterator` instead of `Iterator`.
|
* Generic type parameter of `Engine::register_iterator` is `IntoIterator` instead of `Iterator`.
|
||||||
* Fixes parsing of block comments ending with `**/` or inner blocks starting with `//*`.
|
* Fixes parsing of block comments ending with `**/` or inner blocks starting with `//*`.
|
||||||
|
|
||||||
@ -37,8 +43,8 @@ New features
|
|||||||
|
|
||||||
* `AST::iter_functions` now returns `ScriptFnMetadata` which includes, among others, _doc-comments_ for functions prefixed by `///` or `/**`.
|
* `AST::iter_functions` now returns `ScriptFnMetadata` which includes, among others, _doc-comments_ for functions prefixed by `///` or `/**`.
|
||||||
* _Doc-comments_ can be enabled/disabled with the new `Engine::set_doc_comments` method.
|
* _Doc-comments_ can be enabled/disabled with the new `Engine::set_doc_comments` method.
|
||||||
* A new feature `metadata` is added that pulls in `serde_json` and enables `Engine::gen_fn_metadata_to_json` and ``Engine::gen_fn_metadata_with_ast_to_json` which exports the full list of functions metadata (including those inside an `AST`) in JSON format.
|
* A new feature `metadata` is added that pulls in `serde_json` and enables `Engine::gen_fn_metadata_to_json` and `Engine::gen_fn_metadata_with_ast_to_json` which exports the full list of functions metadata (including those inside an `AST`) in JSON format.
|
||||||
* `Engine::on_debug` provides two additional parameters: `source: Option<&str>` and `pos: Position`.
|
* `Engine::on_debug` provides two additional parameters: `source: Option<&str>` and `pos: Position`, containing the current source (if any) and position of the `debug` statement.
|
||||||
* `NativeCallContext` and `EvalContext` both expose `source()` which returns the current source, if any.
|
* `NativeCallContext` and `EvalContext` both expose `source()` which returns the current source, if any.
|
||||||
|
|
||||||
Enhancements
|
Enhancements
|
||||||
@ -46,7 +52,6 @@ Enhancements
|
|||||||
|
|
||||||
* A functions lookup cache is added to make function call resolution faster.
|
* A functions lookup cache is added to make function call resolution faster.
|
||||||
* Capturing a constant variable in a closure is now supported, with no cloning.
|
* Capturing a constant variable in a closure is now supported, with no cloning.
|
||||||
* Provides position info for `debug` statements.
|
|
||||||
* A _look-ahead_ symbol is provided to custom syntax parsers, which can be used to parse variable-length symbol streams.
|
* A _look-ahead_ symbol is provided to custom syntax parsers, which can be used to parse variable-length symbol streams.
|
||||||
|
|
||||||
|
|
||||||
|
@ -4,20 +4,21 @@ Export Functions Metadata to JSON
|
|||||||
{{#include ../../links.md}}
|
{{#include ../../links.md}}
|
||||||
|
|
||||||
|
|
||||||
`Engine::gen_fn_metadata_to_json`
|
`Engine::gen_fn_metadata_to_json`<br/>`Engine::gen_fn_metadata_with_ast_to_json`
|
||||||
--------------------------------
|
------------------------------------------------------------------------------
|
||||||
|
|
||||||
As part of a _reflections_ API, `Engine::gen_fn_metadata_to_json` exports the full list
|
As part of a _reflections_ API, `Engine::gen_fn_metadata_to_json` and the corresponding
|
||||||
of [functions metadata] in JSON format.
|
`Engine::gen_fn_metadata_with_ast_to_json` export the full list of [functions metadata]
|
||||||
|
in JSON format.
|
||||||
|
|
||||||
The [`metadata`] feature must be used to turn on this method, which requires
|
The [`metadata`] feature must be used to turn on this API, which requires
|
||||||
the [`serde_json`](https://crates.io/crates/serde_json) crate.
|
the [`serde_json`](https://crates.io/crates/serde_json) crate.
|
||||||
|
|
||||||
### Sources
|
### Sources
|
||||||
|
|
||||||
Functions from the following sources are included:
|
Functions from the following sources are included:
|
||||||
|
|
||||||
1) Script-defined functions in an [`AST`], if provided
|
1) Script-defined functions in an [`AST`] (for `Engine::gen_fn_metadata_with_ast_to_json`)
|
||||||
2) Native Rust functions registered into the global namespace via the `Engine::register_XXX` API
|
2) Native Rust functions registered into the global namespace via the `Engine::register_XXX` API
|
||||||
3) _Public_ (i.e. non-[`private`]) functions (native Rust or Rhai scripted) in global sub-modules registered via
|
3) _Public_ (i.e. non-[`private`]) functions (native Rust or Rhai scripted) in global sub-modules registered via
|
||||||
[`Engine::register_module`]({{rootUrl}}/rust/modules/create.md)
|
[`Engine::register_module`]({{rootUrl}}/rust/modules/create.md)
|
||||||
|
@ -648,7 +648,9 @@ impl AsRef<Module> for AST {
|
|||||||
/// This type is volatile and may change.
|
/// This type is volatile and may change.
|
||||||
#[derive(Debug, Clone, Eq, PartialEq, Hash)]
|
#[derive(Debug, Clone, Eq, PartialEq, Hash)]
|
||||||
pub struct Ident {
|
pub struct Ident {
|
||||||
|
/// Identifier name.
|
||||||
pub name: ImmutableString,
|
pub name: ImmutableString,
|
||||||
|
/// Declaration position.
|
||||||
pub pos: Position,
|
pub pos: Position,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user