Stephen Chung
187a20fd8b
Refactor OptimizationLevel.
2022-02-07 21:03:39 +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
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
Stephen Chung
96dbbc76e4
Use StaticVec for function resolution caches for the common case where no modules are used.
2021-09-12 13:33:55 +08:00
Stephen Chung
6510b617fe
Reduce usage of Default::default()
2021-09-11 19:40:40 +08:00
Stephen Chung
84be799403
Change StaticVec to 3 inline elements.
2021-09-10 20:25:22 +08:00
Stephen Chung
43de522568
Use option flags for certain AST nodes.
2021-09-10 20:23:59 +08:00
Stephen Chung
09da9ddcbc
Move unit tests into separate file.
2021-09-07 22:12:04 +08:00
Stephen Chung
5ac33ce64d
Do not export FloatWrapper
under no_float
.
2021-09-04 18:43:18 +08:00
Stephen Chung
06f217d526
Move deprecated functions into separate file.
2021-08-17 15:50:56 +08:00
Stephen Chung
81770f00e0
Rename variables and constants for bit flags.
2021-08-04 11:16:11 +08:00
Stephen Chung
1d82a11f0b
Change AST nodes to use bitflags for options.
2021-08-03 22:19:25 +08:00
Stephen Chung
0944261b88
Merge Stmt::Let and Stmt::Const into Stmt::Var.
2021-08-01 11:59:53 +08:00
Stephen Chung
c7498503ba
Use lower case for feature marker.
2021-07-25 22:56:05 +08:00
Stephen Chung
694ac5b5bd
General code fixups.
2021-07-04 16:40:15 +08:00
Stephen Chung
a0f51a1a39
Split calc_qualified_var_hash.
2021-06-30 16:28:37 +08:00
Stephen Chung
f033896fec
Add From<BTreeSet> and From<HashSet> for Dynamic.
2021-06-30 11:08:29 +08:00
Stephen Chung
178fe6b978
Remove deprecated API.
2021-06-24 09:48:44 +08:00
Stephen Chung
425e038f4b
Split FnPtr into own file.
2021-06-17 09:50:32 +08:00
Stephen Chung
c492fa3234
Do not export SmartString.
2021-06-16 19:02:37 +08:00
Stephen Chung
204dcf60ac
Export Identifier only when internals.
2021-06-16 18:58:48 +08:00
Stephen Chung
42a14ab4cc
Make file structures consistent.
2021-06-16 18:36:33 +08:00
Stephen Chung
1545b602a7
Streamline hashing function.
2021-05-19 20:26:11 +08:00
Stephen Chung
fd19d625b0
Refine doc comments.
2021-05-10 11:07:19 +08:00
Stephen Chung
2cf59e9954
Expose DynamicReadLock and DynamicWriteLoc under internals.
2021-05-10 09:43:45 +08:00
Stephen Chung
d230f448c0
Add no_smartstring to disable using SmartString.
2021-05-08 22:59:33 +08:00
Stephen Chung
335ab64a2c
Use SmartString inside ImmutableString.
2021-04-23 19:10:10 +08:00
Stephen Chung
8f1bff2ded
Change hash to hashes.
2021-04-20 22:26:08 +08:00
Stephen Chung
01f0cc028b
Use no-std-compat to build no-std.
2021-04-17 15:15:54 +08:00
Stephen Chung
6c92011ea1
Hide is_shared and is_locked under feature gates.
2021-04-17 12:03:29 +08:00
Stephen Chung
e6ea006ac6
Fix builds.
2021-04-05 00:05:56 +08:00
Stephen Chung
e306a92ea0
Change Map keys to Identifier.
2021-03-29 17:14:22 +08:00
Stephen Chung
41b48d591f
Change to no_smartstring feature.
2021-03-29 17:13:54 +08:00
Stephen Chung
07efdddba3
Add smartstring default feature.
2021-03-29 13:40:33 +08:00
Stephen Chung
e5249cc1ae
Extract Identifier type.
2021-03-29 11:36:02 +08:00
Stephen Chung
8e8c367034
Update deprecated methods with since attribute.
2021-03-28 17:04:16 +08:00
Stephen Chung
f70225ca1d
Change HashMap to BTreeMap.
2021-03-23 12:13:53 +08:00
Stephen Chung
a82f0fc738
Allow non-Dynamic in return_raw.
2021-03-22 11:18:09 +08:00
Stephen Chung
6667a22c0c
Code style and docs.
2021-03-17 13:30:47 +08:00
Stephen Chung
d0922adb5b
Deprecate RegisterFn and RegisterResultFn.
2021-03-15 11:36:30 +08:00
Stephen Chung
cbad703b00
Flatten data structures and more aggressive inlining.
2021-03-10 13:32:09 +08:00
Stephen Chung
975bb3d6bf
Map in operator to contains function call.
2021-03-09 13:44:54 +08:00
Stephen Chung
57140cbeeb
Fix internals build.
2021-03-08 15:55:26 +08:00
Stephen Chung
62928f8613
Revise function hashing.
2021-03-08 15:30:32 +08:00
Stephen Chung
330d3f87af
Use namespace for ScriptFnDef.
2021-03-07 22:10:54 +08:00
Stephen Chung
8f0830af1c
Expose Variant under internals.
2021-03-05 14:18:36 +08:00
Stephen Chung
4e69b1847d
Turn Shared into alias.
2021-03-04 14:08:11 +08:00
Stephen Chung
ed568a9395
Make RhaiResult internal.
2021-03-03 22:49:29 +08:00
Stephen Chung
58df3ca141
Fix decimal and no_std builds.
2021-03-03 13:34:29 +08:00
Stephen Chung
7262d63909
Move default comparisons into builtin.
2021-03-02 23:08:54 +08:00
Stephen Chung
e3e53bd399
Introduce RhaiResult.
2021-03-02 15:02:28 +08:00
Stephen Chung
b76e8da5ee
Cache built-in functions to improve resolution speed.
2021-03-02 13:48:41 +08:00