Commit Graph

1509 Commits

Author SHA1 Message Date
Stephen Chung
e5249cc1ae Extract Identifier type. 2021-03-29 11:36:02 +08:00
Stephen Chung
241f5abe10 Change function call name into ImmutableString from Cow<str>. 2021-03-28 23:06:59 +08:00
Stephen Chung
7bdc2e3d20 Extract constant arguments from function calls. 2021-03-28 19:04:25 +08:00
Stephen Chung
8e8c367034 Update deprecated methods with since attribute. 2021-03-28 17:04:16 +08:00
Stephen Chung
7825cb1c56 Support shebangs in scripts. 2021-03-28 16:36:56 +08:00
Stephen Chung
47588f9784 Fix codegen tests. 2021-03-27 08:12:13 +08:00
Stephen Chung
0afc2a0842 Reverse Module::set_plugin_fn. 2021-03-26 18:41:28 +08:00
Stephen Chung
33f88dc813 Fix sync build. 2021-03-26 16:57:28 +08:00
Stephen Chung
c443c3bb48 Gate codegen metadata output under metadata feature. 2021-03-26 10:59:34 +08:00
Stephen Chung
8ea218f907 Metadata pulls in serde. 2021-03-25 19:49:30 +08:00
Stephen Chung
adbb5f8eb8 Use static array for codegen parameters info. 2021-03-25 14:02:50 +08:00
Stephen Chung
1d661f2c8e Fix decimal build. 2021-03-24 22:26:07 +08:00
Stephen Chung
ac7f35cacb Move all functions metadata into metadata feature. 2021-03-24 19:27:38 +08:00
Stephen Chung
c4fe1782df Streamline string handling. 2021-03-24 13:17:52 +08:00
Stephen Chung
3a1e93e324 Fix no_std build. 2021-03-24 10:38:56 +08:00
Stephen Chung
3d0d5d1708 Streamline code. 2021-03-24 10:02:50 +08:00
Stephen Chung
6d1700728a Intern module registration strings. 2021-03-24 09:56:25 +08:00
Stephen Chung
0d7f2c16cc Reduce indirections. 2021-03-23 20:04:54 +08:00
Stephen Chung
f9429c06f9 Use template for object map literal. 2021-03-23 18:25:40 +08:00
Stephen Chung
f70225ca1d Change HashMap to BTreeMap. 2021-03-23 12:13:53 +08:00
Stephen Chung
7a0032fc89 Move return type to param_names. 2021-03-22 23:11:23 +08:00
Stephen Chung
42d7736d94 Add conversions between Decimal and FLOAT. 2021-03-22 15:16:01 +08:00
Stephen Chung
22ff68cdc9 Fix feature builds. 2021-03-22 12:18:13 +08:00
Stephen Chung
a82f0fc738 Allow non-Dynamic in return_raw. 2021-03-22 11:18:09 +08:00
Stephen Chung
297a539528 Flatten function call arguments. 2021-03-20 23:57:43 +08:00
Stephen Chung
aa0594210c Use RhaiResult for plugin return. 2021-03-19 10:30:30 +08:00
Stephen Chung
1200ffcd2b Add test with &str parameter. 2021-03-17 22:32:22 +08:00
Stephen Chung
e2a66e0241 Fix doc tests. 2021-03-17 14:45:40 +08:00
Stephen Chung
6667a22c0c Code style and docs. 2021-03-17 13:30:47 +08:00
Stephen Chung
699131be58 New reserved keywords. 2021-03-17 10:31:50 +08:00
Stephen Chung
4581943435 Remove public_only parameters. 2021-03-17 09:58:08 +08:00
Stephen Chung
5172ade179 Code style edits. 2021-03-16 18:16:40 +08:00
Stephen Chung
082ecaa739 Fix feature builds. 2021-03-15 23:03:26 +08:00
Stephen Chung
a1549bb377 Allow register_result to return any type. 2021-03-15 22:37:50 +08:00
Stephen Chung
27953ef745 Register parameter type names. 2021-03-15 22:19:21 +08:00
Stephen Chung
6cbf771fdd Fix private function signature. 2021-03-15 21:30:55 +08:00
Stephen Chung
e9f280f917 Deprecate Module::set_fn_XXX API. 2021-03-15 12:39:06 +08:00
Stephen Chung
d0922adb5b Deprecate RegisterFn and RegisterResultFn. 2021-03-15 11:36:30 +08:00
Stephen Chung
d9df6aabc8 Change precedence to own type. 2021-03-14 10:47:29 +08:00
Stephen Chung
008ef0a41b Fix feature builds. 2021-03-14 10:47:21 +08:00
Stephen Chung
4e3fdf6dab Revamp statement block optimization. 2021-03-13 23:43:05 +08:00
Stephen Chung
58d28fb468 Fix no-std build. 2021-03-13 19:08:49 +08:00
Stephen Chung
558ffeaf3e Add FnResolutionCacheEntry. 2021-03-13 18:46:08 +08:00
Stephen Chung
61b0c7b2b3 Optimize imports layout. 2021-03-12 22:30:08 +08:00
Stephen Chung
81ca86a8d2 Fix internals build. 2021-03-12 19:33:22 +08:00
Stephen Chung
b74d2ff2b4 Fix test. 2021-03-12 14:13:19 +08:00
Stephen Chung
85fcb74be9 Furtuer optimize data structure sizes. 2021-03-12 14:11:08 +08:00
Stephen Chung
4e5d009386 Inline scope entries. 2021-03-12 13:26:47 +08:00
Stephen Chung
c2a34bd518 Fix internals build. 2021-03-11 22:27:35 +08:00
Stephen Chung
7b8a4c46e7 Add ability to terminate AST walk. 2021-03-11 21:55:55 +08:00
Stephen Chung
b2fd0222de Refine statement block optimization. 2021-03-11 18:29:22 +08:00
Stephen Chung
99020f3ed1 Fix builds. 2021-03-10 23:37:04 +08:00
Stephen Chung
9b37d84a9b Enable/disable caching in FileModuleResolver. 2021-03-10 23:01:04 +08:00
Stephen Chung
728ed81173 Optimize layout. 2021-03-10 22:12:48 +08:00
Stephen Chung
874b3fc843 Fix metadata build. 2021-03-10 14:10:04 +08:00
Stephen Chung
cbad703b00 Flatten data structures and more aggressive inlining. 2021-03-10 13:32:09 +08:00
Stephen Chung
352408fd36 Flatten statement blocks. 2021-03-10 12:27:10 +08:00
Stephen Chung
2ff2789326 Fix Stmt size. 2021-03-09 23:48:40 +08:00
Stephen Chung
b11b8d6d39 Reduce redirections in Stmt. 2021-03-09 23:30:48 +08:00
Stephen Chung
8853ebf059 Remove EvalAltResult::ErrorInExpr. 2021-03-09 19:13:26 +08:00
Stephen Chung
9daa894e25 Pack method call args more tightly. 2021-03-09 18:11:43 +08:00
Stephen Chung
bc2b9bfbfd Fix builds. 2021-03-09 14:39:03 +08:00
Stephen Chung
b78c6ddf62 Better debug display. 2021-03-09 14:00:21 +08:00
Stephen Chung
975bb3d6bf Map in operator to contains function call. 2021-03-09 13:44:54 +08:00
Stephen Chung
ff7844893d Add contains for array. 2021-03-09 13:16:05 +08:00
Stephen Chung
7805540b7b Improve in statement. 2021-03-09 11:55:49 +08:00
Stephen Chung
795a3afa81 Use reference for method call parameters, add position info. 2021-03-09 00:07:05 +08:00
Stephen Chung
fefa5a7dc7 Split has_script_fn and has_native_fn. 2021-03-08 18:40:23 +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
1c3a07fe86 Fix metadata build. 2021-03-07 22:37:23 +08:00
Stephen Chung
a7ff9fb24f Add bytes method for strings. 2021-03-07 22:33:02 +08:00
Stephen Chung
330d3f87af Use namespace for ScriptFnDef. 2021-03-07 22:10:54 +08:00
Stephen Chung
e87f981674 Fix sync build. 2021-03-06 22:07:20 +08:00
Stephen Chung
4da5af8aae Do not flatten arguments passed by value. 2021-03-06 21:25:49 +08:00
Stephen Chung
a126d05c3f Skip evaluate condition for loop statement. 2021-03-06 16:05:22 +08:00
Stephen Chung
e14bef4b10 Trap &mut String parameters. 2021-03-06 14:41:35 +08:00
Stephen Chung
fe633ea7d3 Fix bug when passing shared string variable to &str parameter. 2021-03-06 10:44:55 +08:00
Stephen Chung
426f841aa2 Fix serde build. 2021-03-05 23:41:20 +08:00
Stephen Chung
a251219730 Remove public Dynamic::as_str. 2021-03-05 23:00:27 +08:00
Stephen Chung
ca1ce6b6b8 Streamline macros. 2021-03-05 22:58:20 +08:00
Stephen Chung
65ef32af19 Calculate whether contains global functions during indexing. 2021-03-05 20:07:35 +08:00
Stephen Chung
4e5039d4fe Fix bug in built-in string operators. 2021-03-05 20:06:49 +08:00
Stephen Chung
8f0830af1c Expose Variant under internals. 2021-03-05 14:18:36 +08:00
Stephen Chung
2052942d9d Add Dynamic::as_unit. 2021-03-05 13:34:58 +08:00
Stephen Chung
88943915a7 Fix decimal build. 2021-03-05 12:58:27 +08:00
Stephen Chung
4c5ea8decc Fix switch of non-hashable value. 2021-03-05 10:33:48 +08:00
Stephen Chung
0fa3968b74 Try not to check slice bounds in straight hasher. 2021-03-05 09:31:56 +08:00
Stephen Chung
01664ef7ee Fix range overflow panics. 2021-03-04 23:47:52 +08:00
Stephen Chung
8d487906cc Remove unnecessary implementation. 2021-03-04 22:57:24 +08:00
Stephen Chung
0f56b56b9c Fix range function. 2021-03-04 21:43:00 +08:00
Stephen Chung
0589572d19 Refine inlining. 2021-03-04 18:13:47 +08:00
Stephen Chung
4e69b1847d Turn Shared into alias. 2021-03-04 14:08:11 +08:00
Stephen Chung
399e7b0e28 Streamline macros. 2021-03-04 13:13:51 +08:00
Stephen Chung
22c392d796 Fix no_closure build. 2021-03-04 10:50:45 +08:00
Stephen Chung
2707b887c6 Fix shared value assignments. 2021-03-04 10:24:14 +08:00
Stephen Chung
ade290da7e Simplify lifetimes. 2021-03-03 22:49:57 +08:00
Stephen Chung
ed568a9395 Make RhaiResult internal. 2021-03-03 22:49:29 +08:00
Stephen Chung
dfc1ea692f Implement built-in operators with macros. 2021-03-03 21:46:48 +08:00
Stephen Chung
41c39a2060 Remove Dynamic::as_locked_immutable_string. 2021-03-03 18:13:41 +08:00
Stephen Chung
58df3ca141 Fix decimal and no_std builds. 2021-03-03 13:34:29 +08:00
Stephen Chung
77277ebf37 Use as_xxx() API. 2021-03-03 13:16:53 +08:00
Stephen Chung
2c8b15c740 Private global functions are still exposed. 2021-03-03 11:40:27 +08:00
Stephen Chung
ce6e6ceaaa Fix serde build. 2021-03-02 23:19:35 +08:00
Stephen Chung
7262d63909 Move default comparisons into builtin. 2021-03-02 23:08:54 +08:00
Stephen Chung
5b1f80f5ce Store negative result from has_override to function resolution cache. 2021-03-02 22:31:07 +08:00
Stephen Chung
6fd2262ace Remove unnecessary is_def_fn function. 2021-03-02 22:27:53 +08:00
Stephen Chung
e3e53bd399 Introduce RhaiResult. 2021-03-02 15:02:28 +08:00
Stephen Chung
521c8fad27 Streamline ref object backup. 2021-03-02 14:44:21 +08:00
Stephen Chung
b76e8da5ee Cache built-in functions to improve resolution speed. 2021-03-02 13:48:41 +08:00
Stephen Chung
67d277aa21 Disallow overriding keywords. 2021-03-01 22:44:56 +08:00
Stephen Chung
fc10df7d63 Keyword can no longer be overloaded. 2021-03-01 17:17:13 +08:00
Stephen Chung
b7e864bb78 Extract function resolution code. 2021-03-01 16:53:03 +08:00
Stephen Chung
b466d58192 Remove unnecessary AsRef and impl IntoIterator. 2021-03-01 15:58:11 +08:00
Stephen Chung
061fce1f02 No more pub_only. 2021-03-01 15:39:49 +08:00
Stephen Chung
1300ad8677 No need to copy sub-modules. 2021-03-01 14:54:20 +08:00
Stephen Chung
733f4af8b3 Fix no_std build. 2021-03-01 09:30:23 +08:00
Stephen Chung
8eee21ff38 Use object map as catch error value. 2021-02-28 14:38:34 +08:00
Stephen Chung
66b557692b Allow negative range step. 2021-02-27 15:27:40 +08:00
Stephen Chung
082111074e Encapsulate gen_call_signature. 2021-02-27 15:07:16 +08:00
Stephen Chung
c8addb45ac Set position for errors in native function call. 2021-02-27 15:06:57 +08:00
Stephen Chung
d935401b03 Allow evaluating AST in Engine::call_fn_dynamic. 2021-02-26 11:21:23 +08:00
Stephen Chung
3f4dba9dbc Build in operators between string and char. 2021-02-25 13:29:49 +08:00
Stephen Chung
f03983a9ca Expose Engine::map_type_name. 2021-02-25 11:04:01 +08:00
Stephen Chung
1c1dfc701f Fix Decimal. 2021-02-25 11:03:54 +08:00
Stephen Chung
9495d3f733 Separate op-assignment with other function calls. 2021-02-25 10:59:22 +08:00
Stephen Chung
49e5382ab0 Do not return default for comparisons between same types. 2021-02-25 10:59:11 +08:00
Stephen Chung
02057ef1d2 Avoid double checking of builtin's. 2021-02-24 23:23:32 +08:00
Stephen Chung
baaa0461bf Limit Dynamic parameters to 16. 2021-02-24 22:40:18 +08:00
Stephen Chung
37540fda12 Fix bug with op-assignment. 2021-02-24 16:17:04 +08:00
Stephen Chung
9d6ad2092c Fix decimal build. 2021-02-24 15:56:29 +08:00
Stephen Chung
4ac05aee8b Disallow implicit comparisons between different numeric types. 2021-02-24 15:45:29 +08:00
Stephen Chung
0d933d865a Do not test for built-in's when operands are not built-in. 2021-02-24 13:53:11 +08:00
Stephen Chung
c501b34191 Implement strings concat via Dynamic wildcards. 2021-02-24 11:28:21 +08:00
Stephen Chung
c739e54e5b Refine strings package. 2021-02-24 11:05:39 +08:00
Stephen Chung
8b67a9a9bc Do not test for op-assignment when not ending with '='. 2021-02-24 11:05:16 +08:00
Stephen Chung
71680e3c77 Extract op assignment into function. 2021-02-24 11:04:54 +08:00
Stephen Chung
6f876e85cc Always call native for op-assignment operators. 2021-02-23 20:32:50 +08:00
Stephen Chung
123e9d6901 Short-circuits op-assignment for indexing and dotting. 2021-02-23 20:03:28 +08:00
Stephen Chung
36420f0b99 Implement print/debug functions via Dynamic parameters. 2021-02-23 19:08:05 +08:00
Stephen Chung
ba2b0630f7 Add support for Dynamic wildcard arguments. 2021-02-23 16:06:36 +08:00
Stephen Chung
8248c9999d Add split version for chars. 2021-02-23 12:52:47 +08:00
Stephen Chung
e88713611c Add split for arrays. 2021-02-23 11:57:50 +08:00
Stephen Chung
ac3d8e35d4 Add splitn, rsplit and rsplitn equivalents to strings. 2021-02-23 11:56:04 +08:00
Stephen Chung
0b49865f29 Fix no_std build. 2021-02-21 14:41:20 +08:00
Stephen Chung
4120e3c88e Include decimal in generated docs. 2021-02-21 14:26:31 +08:00
Stephen Chung
54e26059dc Set correct position for system errors inside function calls. 2021-02-20 14:32:37 +08:00
Stephen Chung
72334f0c42 Lower release stack overflow protection limit. 2021-02-20 14:05:47 +08:00
Stephen Chung
5285dad1a8 Fix feature build. 2021-02-19 23:48:11 +08:00
Stephen Chung
182fc2c3d1 Check for constant values passed to methods. 2021-02-19 23:13:53 +08:00