Commit Graph

255 Commits

Author SHA1 Message Date
Stephen Chung
728ed81173 Optimize layout. 2021-03-10 22:12:48 +08:00
Stephen Chung
b11b8d6d39 Reduce redirections in Stmt. 2021-03-09 23:30:48 +08:00
Stephen Chung
9daa894e25 Pack method call args more tightly. 2021-03-09 18:11:43 +08:00
Stephen Chung
975bb3d6bf Map in operator to contains function call. 2021-03-09 13:44:54 +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
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
4da5af8aae Do not flatten arguments passed by value. 2021-03-06 21:25:49 +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
a251219730 Remove public Dynamic::as_str. 2021-03-05 23:00:27 +08:00
Stephen Chung
65ef32af19 Calculate whether contains global functions during indexing. 2021-03-05 20:07:35 +08:00
Stephen Chung
0589572d19 Refine inlining. 2021-03-04 18:13:47 +08:00
Stephen Chung
ade290da7e Simplify lifetimes. 2021-03-03 22:49:57 +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
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
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
3f4dba9dbc Build in operators between string and char. 2021-02-25 13:29:49 +08:00
Stephen Chung
1c1dfc701f Fix Decimal. 2021-02-25 11:03:54 +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
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
8b67a9a9bc Do not test for op-assignment when not ending with '='. 2021-02-24 11:05:16 +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
0b49865f29 Fix no_std build. 2021-02-21 14:41:20 +08:00
Stephen Chung
54e26059dc Set correct position for system errors inside function calls. 2021-02-20 14:32:37 +08:00
Stephen Chung
bd5ff457d2 Built-in interop between FLOAT/Decimal and INT. 2021-02-19 11:47:26 +08:00
Stephen Chung
9a9adbefcc Wrap eval errors in ErrorInFunctionCall. 2021-02-18 14:33:12 +08:00
Stephen Chung
909d48caed Provide short-cuts to Decimal calculations. 2021-02-15 17:42:33 +08:00
Stephen Chung
d49581356d Remove duplicated functions lookup for script function call. 2021-02-11 12:13:30 +08:00
Stephen Chung
61638d6566 Use ** for power/exponentiation. 2021-02-10 12:41:27 +08:00
Stephen Chung
58528db45c Encapsulate functions resolution cache into State API. 2021-02-07 17:56:29 +08:00
Stephen Chung
a76bed2f46 Use eval_statements_block when at global. 2021-02-07 17:06:33 +08:00
Stephen Chung
aafff4fb93 Use stacked functions resolution caches to further improve performance. 2021-02-07 15:41:40 +08:00
Stephen Chung
7b87f81850 Add has_override and script calls to function resolution cache. 2021-02-07 15:09:27 +08:00
Stephen Chung
dff124b242 Save functions resolution cache during script call. 2021-02-06 22:16:05 +08:00
Stephen Chung
c5e2620d0f Minor code refactors. 2021-02-03 19:14:26 +08:00
Stephen Chung
3b42cc5bb2 Fix bug where plugin module parameters are consumed. 2021-01-23 09:37:27 +08:00
Stephen Chung
8aae3ac46c Add function name to NativeCallContext. 2021-01-21 21:49:25 +08:00
Stephen Chung
92c7fd9e5b Better error messages. 2021-01-15 17:13:04 +08:00
Stephen Chung
e2a47b2a65 Disallow duplicated function definitions. 2021-01-03 20:54:08 +08:00
Stephen Chung
70a0d6ce58 Make id_raw return Option<&ImmutableString> 2021-01-03 11:25:25 +08:00
Stephen Chung
1bbf473ec7 Add source info to native calls. 2021-01-03 00:20:13 +08:00
Stephen Chung
ef48f47b74 Refine docs and comments etc. 2021-01-02 23:30:10 +08:00
Stephen Chung
ba7f8c6391 Propagate source info. 2020-12-30 21:12:51 +08:00
Stephen Chung
13f5cec291 Fix call stack limits. 2020-12-29 12:29:45 +08:00
Stephen Chung
eca8212f38 More code refinements. 2020-12-29 10:41:20 +08:00
Stephen Chung
e481a8019d Simplify code and better error messages. 2020-12-28 14:21:13 +08:00
Stephen Chung
dc4e52e795 Code enhancements. 2020-12-26 13:05:57 +08:00
Stephen Chung
363085efc3 Map actual 0 hash to 42. 2020-12-24 18:43:04 +08:00
Stephen Chung
8506640073 Use NonZeroU64 for function hashes. 2020-12-24 16:32:43 +08:00
Stephen Chung
15fb03218c Rename packages to global modules. 2020-12-22 23:45:14 +08:00
Stephen Chung
0157f912e0 Remove PackageLibrary and PackagesCollection. 2020-12-22 22:36:30 +08:00
Stephen Chung
206400b187 Fix serde feature. 2020-12-22 15:27:27 +08:00
Stephen Chung
ff67efc6d5 Add source to contexts. 2020-12-21 23:12:45 +08:00
Stephen Chung
5ac83f0f46 Add context source to on_debug. 2020-12-21 22:04:46 +08:00
Stephen Chung
2955a4ab64 Fix unary operators binding. 2020-12-21 17:39:37 +08:00
Stephen Chung
730a7320d6 Run eval with new State. 2020-12-20 23:46:46 +08:00
Stephen Chung
cec27846ea Simplify code. 2020-12-20 23:25:11 +08:00
Stephen Chung
0182b2d3f4 Correct speed claim and others in docs. 2020-12-19 17:46:34 +08:00
Stephen Chung
d73f3a1d60 Add functions lookup cache. 2020-12-18 23:47:17 +08:00
Stephen Chung
db7b9cb0f9 Native only if function call is not a valid identifier. 2020-12-18 23:03:56 +08:00
Stephen Chung
1087c338bd Change output of AST::iter_functions. 2020-12-12 16:31:13 +08:00
Stephen Chung
40b6a014ae Provide Position to debug. 2020-12-12 11:47:18 +08:00
Stephen Chung
5443368359 Pass Position into function calls. 2020-12-12 11:15:09 +08:00
Stephen Chung
7598ec136f Fix feature builds. 2020-12-08 23:09:12 +08:00
Stephen Chung
f22a04fc74 Move constancy into Dynamic. 2020-12-08 22:47:38 +08:00
Stephen Chung
a0979d0c35 Code cleanup 2020-11-25 09:36:06 +08:00
Stephen Chung
739dce72e3 Move if_def_fn into CorePackage. 2020-11-22 15:41:55 +08:00
Stephen Chung
783803ec46 Update comments with links. 2020-11-20 16:52:28 +08:00
Stephen Chung
5e4ede6f07 global_module -> global_namespace. 2020-11-19 13:56:03 +08:00
Stephen Chung
999a87f86e Fix no_optimize build. 2020-11-16 23:32:44 +08:00
Stephen Chung
272c8505b8 Refactor use. 2020-11-16 23:10:14 +08:00
Stephen Chung
d50d48f26f Move definition of Array and Map to lib.rs. 2020-11-16 21:14:32 +08:00
Stephen Chung
adb902326e Reduce feature gates on imports. 2020-11-16 16:28:04 +08:00
Stephen Chung
ef02150afd Expose methods for Engine::register_module. 2020-11-16 14:07:48 +08:00
Stephen Chung
b75964e383 Add Dynamic::UNIT. 2020-11-15 23:14:29 +08:00
Stephen Chung
89254a04c4 Fix tests. 2020-11-14 17:22:01 +08:00
Stephen Chung
56fbe39b7b Use references for switch expressions, if possible. 2020-11-14 16:08:48 +08:00
Stephen Chung
958762079e Change modules to namespace. 2020-11-10 23:26:50 +08:00
Stephen Chung
e69444293c Encapsulate imported modules into AST. 2020-11-09 21:52:23 +08:00
Stephen Chung
48886eacc8 Add == and != to arrays and maps. 2020-11-08 23:00:37 +08:00
Stephen Chung
b3d318ef7f Module resolver returns shared module. 2020-11-07 23:33:21 +08:00
Stephen Chung
6bc5ba6668 Enable functions to use global imports. 2020-11-06 19:17:07 +08:00