Commit Graph

740 Commits

Author SHA1 Message Date
Stephen Chung
0516e8088c Add fast-ops feature. 2022-09-02 23:45:25 +08:00
Stephen Chung
7dbc605d0b Macro test for enums. 2022-08-30 13:56:25 +08:00
Stephen Chung
cfdca74beb Fix test. 2022-08-30 12:31:47 +08:00
Stephen Chung
044484c756 Merge 1.9.1 fixes. 2022-08-29 22:42:46 +08:00
Stephen Chung
0870318e4e Fix bug in strict variables mode. 2022-08-29 22:26:07 +08:00
Stephen Chung
80772df4f4 Shut up clippy. 2022-08-29 14:27:05 +08:00
Stephen Chung
d80184ba14 Allow if-expressions and switch-expressions in Engine::eval_expression. 2022-08-26 23:10:58 +08:00
Stephen Chung
204284f4f7 Add test to recreate NativeCallContext. 2022-08-26 16:20:23 +08:00
Stephen Chung
a9413dc570 Remove _result registration methods. 2022-08-22 22:16:26 +08:00
Stephen Chung
80a23ddaa2 Allow registration of getters/setters/indexers with NativeCallContext. 2022-08-21 22:59:49 +08:00
Stephen Chung
2f02b30b6e Use String::new() for empty strings. 2022-08-21 17:35:44 +08:00
Stephen Chung
1adc094383 Fix tests. 2022-08-20 22:19:29 +08:00
Stephen Chung
de3b7cbbee Add custom syntax test. 2022-08-20 22:10:15 +08:00
Stephen Chung
f9d74fe313 Fix tests. 2022-08-18 21:36:00 +08:00
Stephen Chung
a9b6e8b98c Fix builds. 2022-08-18 21:16:42 +08:00
Stephen Chung
83589be58e New packages API. 2022-08-18 17:22:56 +08:00
Stephen Chung
1c7b80ed13 Use turbofish for impl Trait. 2022-08-12 22:48:15 +08:00
Stephen Chung
be448dfe4d Use identifiers in format! 2022-08-11 19:01:23 +08:00
Tristan Guichaoua
24bf3c29ef Merge remote-tracking branch 'other/master' into type_builder_iterable 2022-08-10 17:31:17 +02:00
Tristan Guichaoua
0046c3a330 impl TypeBuilder::is_iterable 2022-08-10 14:00:43 +02:00
Stephen Chung
8408c190dc Add with_iterator to TypeBuilder. 2022-08-09 18:18:41 +08:00
Stephen Chung
d9a58907d9 Fix up tests and some coding style changes. 2022-08-09 17:07:45 +08:00
Stephen Chung
68c11060d9 Merge branch 'main' of https://github.com/rhaiscript/rhai 2022-08-09 16:31:25 +08:00
Stephen Chung
d9ffac17fa Fix tests. 2022-08-05 23:45:40 +08:00
Stephen Chung
d8532b48b6 Add function pointer short-hand. 2022-08-05 23:30:44 +08:00
Stephen Chung
1073a7bd54 Fix bug in constant interpolated string. 2022-07-29 10:49:03 +08:00
Stephen Chung
fc976172e7 Fix bug with capturing undefined variable. 2022-07-29 09:43:40 +08:00
Stephen Chung
ea38185cac Add ParseError:err_type and ParseError::position. 2022-07-29 09:42:30 +08:00
Stephen Chung
5d799fd325 Add module documentation. 2022-07-25 13:40:23 +08:00
Stephen Chung
7dca916c45 Allow duplicated switch cases. 2022-07-18 13:40:41 +08:00
Stephen Chung
4b760d1d0f Unroll switch ranges if possible. 2022-07-18 08:54:10 +08:00
Stephen Chung
dda7bc7b85 Add eval_expression_tree_raw. 2022-07-06 12:56:15 +08:00
Stephen Chung
b4dbc7619a Add no_custom_syntax. 2022-07-05 22:59:03 +08:00
Stephen Chung
dee66a409f Add case alternatives for switch. 2022-07-04 17:42:24 +08:00
Stephen Chung
0031678cd4 Fix shared variable assignment. 2022-06-26 18:09:15 +08:00
Stephen Chung
335957fbc2 Enable modifying constant shared values. 2022-06-26 17:04:08 +08:00
Stephen Chung
2b44778a5c Add elvis operator for indexing. 2022-06-12 00:32:12 +08:00
Stephen Chung
b9cbeb65d6 Use Option instead of once/empty. 2022-06-11 16:01:15 +08:00
Stephen Chung
8999872d62 Add null coalescing operator. 2022-06-10 11:22:33 +08:00
Stephen Chung
0f1e51b1c9 Support Elvis operator. 2022-06-10 10:26:06 +08:00
Stephen Chung
dcaac20eb9 Strict mode in functions check for static modules. 2022-06-09 17:59:28 +08:00
Stephen Chung
84e3296559 Fix bug on chaining function calls returning shared values. 2022-06-07 11:31:46 +08:00
Stephen Chung
6ebe002b18 Check for missing docs. 2022-06-05 18:17:44 +08:00
Stephen Chung
e4d492c727 Fix no_object build. 2022-05-23 22:58:15 +08:00
Geoffroy Couprie
f2b5566c0b use smartstring's deserializer to support non borrowed strings
The map visitor for Dynamic was expecting a &str for the key, but the
serde_json deserializer internally uses a Cow string, which can be
Borrowed or Owned. In the case of Owned, the serde_json key deserializer
is calling visit_string on the Visitor, which for &str will result in
the error:
Error("invalid type: string \"a\", expected a borrowed string", line: 0,
column: 0)

smartstring actually has its own Visitor implementation that handles
both cases, so we can use it instead of an explicit conversion.
2022-05-23 16:40:49 +02:00
Stephen Chung
1abec0a8a8 Allow initialization of EvalState tag and separate debugger state into separate variable. 2022-05-21 21:44:12 +08:00
Stephen Chung
5435fdb8c8 Fix tests. 2022-05-21 11:57:23 +08:00
Stephen Chung
9c1a49da0b Fix AST combine. 2022-05-21 11:31:15 +08:00
Stephen Chung
42d2718e24 Fix test. 2022-05-19 16:56:22 +08:00
Stephen Chung
a53bcc2e1d Add EvalAltResult::IndexNotFound. 2022-05-19 10:02:12 +08:00
Stephen Chung
591f7d7362 Add tests for index type checks. 2022-05-17 15:20:32 +08:00
Stephen Chung
b23d64bec0 Fix bug with using self-contained AST with call_fn. 2022-05-05 21:34:15 +08:00
Stephen Chung
516f5a82a0 Use tag for debugger state. 2022-05-03 21:55:01 +08:00
Stephen Chung
4f74d2f96a Minor cleanup. 2022-05-02 12:14:53 +08:00
Stephen Chung
c69f98c2c4 Add custom state. 2022-05-02 00:03:45 +08:00
Stephen Chung
5a75479119 Fix bug in Scope cloning. 2022-04-23 11:53:17 +08:00
Stephen Chung
a6c2c00479 Allow variables in scope for strict vars. 2022-04-22 12:12:36 +08:00
Stephen Chung
6f4cc91451 Fix builds. 2022-04-21 16:01:20 +08:00
Stephen Chung
6b8ddd925b Allow scope constants in strict variables mode. 2022-04-21 13:21:53 +08:00
Stephen Chung
4f2764d233 Revise parse_json. 2022-04-21 10:04:57 +08:00
Stephen Chung
5e4f27ae25 Add Token::Unit. 2022-04-21 10:04:46 +08:00
Stephen Chung
3ff1ce0a19 Fix compound assignments with indexers. 2022-04-14 22:55:39 +08:00
Stephen Chung
42f977862f Add Dynamic parameters to qualified function calls. 2022-04-08 16:42:53 +08:00
Stephen Chung
95753bb9c3 Use global module constants in optimization. 2022-03-28 12:53:52 +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
1e4abd012c Minor refactor. 2022-03-09 09:25:55 +08:00
Stephen Chung
0335035b0f Fix bug with eager optimization of method calls. 2022-03-04 12:22:44 +08:00
Stephen Chung
8205547d8a Use bitflags. 2022-02-25 11:42:59 +08:00
Stephen Chung
dd566ed1e1 Fix builds. 2022-02-19 12:26:17 +08:00
Stephen Chung
67a6638818 Allow variable to overwrite constant when shadowing. 2022-02-18 19:14:42 +08:00
Stephen Chung
bb04fab011 Optimize variable shadowing. 2022-02-18 15:04:46 +08:00
Stephen Chung
0d2e3d82f3 Reduce size of Stmt. 2022-02-16 17:51:14 +08:00
Stephen Chung
fb9964e1a3 Revise on_def_var API. 2022-02-15 10:56:05 +08:00
Stephen Chung
5bb6ce835f Run var def filter during parsing. 2022-02-13 18:46:25 +08:00
Stephen Chung
340a047369 Add fail on invalid property for maps. 2022-02-09 13:12:43 +08:00
Stephen Chung
7686ca619a Use .. for (_). 2022-02-08 09:46:14 +08:00
Stephen Chung
f8cee0fe4e Simplify using .. 2022-02-08 09:02:15 +08:00
Stephen Chung
40bec9f017 Fix tests. 2022-02-04 23:02:00 +08:00
Stephen Chung
be9356727f Add variable definition filter. 2022-02-04 22:59:41 +08:00
Stephen Chung
3be27746e0 Add allow_shadowing. 2022-02-04 13:20:47 +08:00
Stephen Chung
e0ed713bb6 Fix builds. 2022-02-02 14:57:30 +08:00
Stephen Chung
4a80483749 Support call stack and FunctionExit for native functions. 2022-02-02 14:47:35 +08:00
Stephen Chung
7163a7331a Add commands and status to debugging interface. 2022-02-01 22:30:05 +08:00
Stephen Chung
dca0185323 Change on_debugger to register_debugger. 2022-02-01 14:07:06 +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
66af69aaff Refactor and add state to debugger. 2022-01-28 18:59:18 +08:00
Stephen Chung
20baae71d4 Factor tuples into structs to aid in understanding. 2022-01-28 10:11:40 +08:00
Stephen Chung
aee35e5f20 Add DebuggingPackage. 2022-01-27 16:58:11 +08:00
Stephen Chung
b76a2be7c3 Fix unchecked build. 2022-01-24 08:49:41 +08:00
Stephen Chung
8d34ffb9f5 Fix bug in try block. 2022-01-24 08:34:21 +08:00
Stephen Chung
97be256a1a Fix bug with optimizing op-assignment operators. 2022-01-23 21:09:37 +08:00
Stephen Chung
c32ace40a4 Fix builds. 2022-01-22 17:27:18 +08:00
Stephen Chung
bb34e316e8 Add custom collection test. 2022-01-18 17:46:24 +08:00
Stephen Chung
00b189d0c6 Replace Cow<str> in Scope with SmartString. 2022-01-15 11:26:43 +08:00
Stephen Chung
2677e7dc8a Fix test for only_i32. 2022-01-14 23:19:27 +08:00
Stephen Chung
5ab7c59ba0 Fix Array::pad infinite loop. 2022-01-13 22:05:07 +08:00
Stephen Chung
5dae2b07f7 Add to_dynamic test for Option. 2022-01-13 19:02:37 +08:00
Stephen Chung
0f4e8848f9 Extract index calculataion into functions. 2022-01-13 18:13:27 +08:00