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
345a060672
Fix type name display.
2022-02-03 23:54:53 +08:00
Stephen Chung
7163a7331a
Add commands and status to debugging interface.
2022-02-01 22:30:05 +08:00
Stephen Chung
f1458e79e0
Improve AST debug display.
2022-01-31 13:38:27 +08:00
Stephen Chung
7b92a80c32
Fix encapsulated environment in module functions.
2022-01-30 17:27:13 +08:00
Stephen Chung
6b02dde848
Gate dead code for no_module.
2022-01-29 11:09:43 +08:00
Stephen Chung
20baae71d4
Factor tuples into structs to aid in understanding.
2022-01-28 10:11:40 +08:00
Stephen Chung
c8357de1c8
Fix feature builds.
2022-01-27 16:58:11 +08:00
Stephen Chung
3cec9751bf
Remove call stack under no_function.
2022-01-27 16:58:11 +08:00
Stephen Chung
40aaab60c3
Refine debugger.
2022-01-27 16:58:11 +08:00
Stephen Chung
fc87dec128
Add debugging interface.
2022-01-27 16:58:11 +08:00
Stephen Chung
96764c0d2d
Fix UINT -> UNSIGNED_INT.
2022-01-13 22:51:56 +08:00
Stephen Chung
0f4e8848f9
Extract index calculataion into functions.
2022-01-13 18:13:27 +08:00
Stephen Chung
37dbc68bf5
Use target_family for wasm.
2022-01-12 08:12:28 +08:00
Stephen Chung
a267ac5e54
Split Engine into eval folder.
2022-01-07 11:43:47 +08:00
Stephen Chung
328f6910b6
Refactor wasm feature gates.
2022-01-04 22:16:20 +08:00
Stephen Chung
d60ed5a502
Reduce size of Variant trait.
2022-01-01 19:54:46 +08:00
Stephen Chung
135b1f54c2
Remove Option from source and use empty string as no source.
2022-01-01 17:20:00 +08:00
Stephen Chung
8329baea29
Fix doc comments.
2021-12-31 23:01:34 +08:00
Stephen Chung
5b667a69b7
Reverse EvalStateData.
2021-12-28 12:19:20 +08:00
Stephen Chung
807240e249
Rename Imports to GlobalRuntimeState.
2021-12-28 11:42:52 +08:00
Stephen Chung
a78488d935
Rename Imports to GlobalRuntimeState.
2021-12-27 23:03:30 +08:00
Stephen Chung
9c7ced2b80
Move custom syntax to api.
2021-12-27 22:02:34 +08:00
Stephen Chung
4d226542fa
Split out strings interner.
2021-12-27 21:56:50 +08:00
Stephen Chung
7a15071e4e
Reduce size of ChainArgument.
2021-12-27 17:00:21 +08:00
Stephen Chung
dfb3378b28
Expand function call arguments inline storage.
2021-12-27 12:27:44 +08:00
Stephen Chung
05d4c81e7a
Use type alias for error.
2021-12-27 12:27:31 +08:00
Stephen Chung
a07faf7dd9
Fix doc test.
2021-12-26 12:16:48 +08:00
Stephen Chung
01c35808cb
Use type alias
2021-12-25 23:49:14 +08:00
Stephen Chung
541ef319bb
Merge branch 'v1.3-fixes'
2021-12-18 18:22:20 +08:00
Stephen Chung
9736171089
Fix bug in hex parsing for negative numbers.
2021-12-18 17:07:30 +08:00
Stephen Chung
ef14079c61
Add ranges.
2021-12-15 12:06:17 +08:00
Stephen Chung
7cd76c6d18
Add language options.
2021-12-03 11:16:35 +08:00
Stephen Chung
a3e79c0bd0
Fix builds.
2021-11-28 23:06:33 +08:00
Stephen Chung
dca47d5233
Remove volatile warnings for types and functions exposed unter internals.
2021-11-28 22:03:02 +08:00
Stephen Chung
4fc088a0f1
Fix feature builds.
2021-11-27 23:20:05 +08:00
Stephen Chung
d56585c877
Remove no_smartstring feature.
2021-11-27 14:24:36 +08:00
Stephen Chung
a757dfe89d
Add blobs.
2021-11-23 14:58:54 +08:00
Stephen Chung
2fffe31b59
Level up exports.
2021-11-16 12:26:37 +08:00
Stephen Chung
64b889fb95
Restructure code base.
2021-11-13 22:36:23 +08:00
Stephen Chung
31ef7e6c69
Fix builds.
2021-11-08 12:07:49 +08:00
wackbyte
9f0347df9f
Fix some rustdoc warnings and a typo in FLOAT's docs
...
Unfortunately, I can't fix the 2 remaining warnings.
2021-10-22 12:03:06 +08:00
Stephen Chung
65ef402440
Eliminate optimize module with no_optimize.
2021-10-21 19:17:34 +08:00
Stephen Chung
cd8af67842
Merge branch 'bug-fixes'
2021-09-24 09:27:45 +08:00
Stephen Chung
d9dca6ef98
Expore more internal data structures.
2021-09-24 09:26:35 +08:00
Stephen Chung
71e8cf727d
Use LazyCompact for SmartString.
2021-09-20 11:34:01 +08:00
Stephen Chung
2d46bf37c8
Fix build.
2021-09-19 22:44:27 +08:00
Stephen Chung
e191f9d91e
Merge branch 'bug-fixes'
2021-09-19 22:34:47 +08:00
Stephen Chung
bdbfa8ef5f
Catch mutually exclusive features.
2021-09-12 21:06:13 +08:00