Stephen Chung
63359f3f81
Unused parameters naming.
2022-04-11 16:29:16 +08:00
Stephen Chung
1b6de25007
Remove Engine::custom_types.
2022-03-29 08:18:20 +08:00
Stephen Chung
5caf20d26b
Search for global variables in global modules.
2022-03-27 21:49:34 +08:00
Stephen Chung
fefa633cf0
Add type alias support for plugin modules.
2022-03-19 09:43:18 +08:00
Stephen Chung
dc8c4ed8f4
Improve string functions.
2022-03-17 17:00:48 +08:00
Stephen Chung
672cda63ab
Simplify formatting.
2022-03-14 08:50:17 +08:00
Stephen Chung
89426f8b3a
Add Scope::set_alias.
2022-03-09 09:25:32 +08:00
Stephen Chung
14e23ed74c
Fix sync build.
2022-03-03 13:14:35 +08:00
Stephen Chung
0e9a16e437
Add checks for is_empty.
2022-03-03 13:02:57 +08:00
Stephen Chung
83755bf936
Refine doc comments.
2022-03-01 15:34:15 +08:00
Stephen Chung
54a61bfe00
Pack Scope data more tightly.
2022-02-28 14:00:55 +08:00
Stephen Chung
b17e891b63
Reduce size of Token.
2022-02-26 23:18:47 +08:00
Stephen Chung
d2ad56e279
Improve string parameters.
2022-02-24 13:39:10 +08:00
Stephen Chung
39ef766bf1
Raise error when exporting local anonymous function.
2022-02-24 11:24:31 +08:00
Stephen Chung
73f10b8adc
Minor housekeeping.
2022-02-24 10:36:20 +08:00
Stephen Chung
78b5c9fd4e
Fix bug in Scope::is_constant.
2022-02-18 19:13:09 +08:00
Stephen Chung
ef87ae48c1
Fix doc-test.
2022-02-18 16:21:20 +08:00
Stephen Chung
bb04fab011
Optimize variable shadowing.
2022-02-18 15:04:46 +08:00
Stephen Chung
5bb6ce835f
Run var def filter during parsing.
2022-02-13 18:46:25 +08:00
Stephen Chung
1c89c6be4f
Doc fixes.
2022-02-10 08:31:41 +08:00
Stephen Chung
340a047369
Add fail on invalid property for maps.
2022-02-09 13:12:43 +08:00
Stephen Chung
83b213b086
Unwrap error when caught.
2022-02-08 19:02:40 +08:00
Stephen Chung
7686ca619a
Use .. for (_).
2022-02-08 09:46:14 +08:00
Stephen Chung
97a8fd3d5b
Improve reify syntax.
2022-02-08 09:25:53 +08:00
Stephen Chung
f8cee0fe4e
Simplify using ..
2022-02-08 09:02:15 +08:00
Stephen Chung
bd9519e96b
Remove reify_dynamic.
2022-02-07 12:02:00 +08:00
Stephen Chung
becbfa8930
Fix errors.
2022-02-06 23:02:59 +08:00
Nathan Kent
86d86a85e4
Remove unsound casting functions
...
The casting functions in `unsafe.rs` were unsound (i.e., they allowed
safe code to cause undefined behavior). While they did appear to be used
in a way that wouldn't cause UB the fact that there exists unsound
functions is unsettling.
This commit removes those functions and replaces it with a macro that
performs the same reification - the difference is that the macro call
will also include the checks which are required to prevent UB. A macro
was chosen instead of a function for two reasons:
1. A macro can keep the same code generation whereas a function would
require going through an `Option` which has negative impacts on code
generation (niche values cause poor DCE).
2. There exist other `unsafe` code blocks in the crate and an attempt to
make Rhai 100% safe is completely out-of-scope for this merge
request, so we may as well use `unsafe` in the macro.
Regarding (2) above, I may come back at a later date with a 100% safe
`reify` function but only once the other `unsafe` blocks are removed.
For posterity, said function would look something like:
```rust
fn reify<A: Any, C>(value: A) -> Option<C> {
let mut v = Some(value);
let v: &mut dyn Any = &mut v;
v.downcast_mut::<Option<C>>().map(Option::take)
}
```
2022-02-05 16:29:05 -08:00
Stephen Chung
3be27746e0
Add allow_shadowing.
2022-02-04 13:20:47 +08:00
Stephen Chung
345a060672
Fix type name display.
2022-02-03 23:54:53 +08:00
Stephen Chung
f1458e79e0
Improve AST debug display.
2022-01-31 13:38:27 +08:00
Stephen Chung
66af69aaff
Refactor and add state to debugger.
2022-01-28 18:59:18 +08:00
Stephen Chung
538af8caee
Scope::clone_visible clones value access mode also.
2022-01-27 16:58:11 +08:00
Stephen Chung
86fc2f7bf1
Refine types display.
2022-01-17 21:51:04 +08:00
Stephen Chung
00b189d0c6
Replace Cow<str> in Scope with SmartString.
2022-01-15 11:26:43 +08:00
Stephen Chung
ae77582028
Minor refactor.
2022-01-14 21:49:38 +08:00
Stephen Chung
37dbc68bf5
Use target_family for wasm.
2022-01-12 08:12:28 +08:00
Stephen Chung
77eb96bd7e
Fix errors.
2022-01-11 11:40:08 +08:00
Stephen Chung
6dedb1ed9f
Fix no_std builds.
2022-01-11 11:33:54 +08:00
Stephen Chung
bc6bf6c6ba
Change expect("exists") to unwrap().
2022-01-06 11:07:52 +08:00
Stephen Chung
b1b4361d08
Fix documentation.
2022-01-06 10:19:25 +08:00
magnus
7bf517b242
Fix documentation
2022-01-06 10:18:02 +08:00
Stephen Chung
123e8b1b48
Improve FnPtr debug display.
2022-01-05 13:48:25 +08:00
Stephen Chung
f35c9c1ac4
Refactor imports.
2022-01-05 12:52:56 +08:00
Stephen Chung
328f6910b6
Refactor wasm feature gates.
2022-01-04 22:16:20 +08:00
Stephen Chung
d99953c101
Fixup AsRef<str> vs &str.
2022-01-04 15:22:48 +08:00
Stephen Chung
d60f14ec27
Streamline hot code.
2022-01-03 23:11:06 +08:00
Stephen Chung
29f1328087
Simplify Dynamic::from for better inlining.
2022-01-02 20:47:03 +08:00
Stephen Chung
d60ed5a502
Reduce size of Variant trait.
2022-01-01 19:54:46 +08:00
Stephen Chung
8329baea29
Fix doc comments.
2021-12-31 23:01:34 +08:00