Commit Graph

320 Commits

Author SHA1 Message Date
Stephen Chung
3408086240 Copy values differently. 2020-05-22 13:08:57 +08:00
Stephen Chung
800a7bf283 Remove unnecessary traits and types. 2020-05-21 17:11:01 +08:00
Stephen Chung
4a1fd66b9f Reduce Rc/Arc wrapping for functions. 2020-05-19 22:25:57 +08:00
Stephen Chung
ab76a69b12 Avoid repeating empty TypeId's when calculating hash. 2020-05-19 20:07:51 +08:00
Stephen Chung
3295060dba Unify all functions under CallableFunction type. 2020-05-19 19:03:06 +08:00
Stephen Chung
6b8c6bda42 Use u64 for operations counter. 2020-05-19 10:08:27 +08:00
Stephen Chung
1824dced69 Limit expression/statement nesting depths. 2020-05-18 19:32:22 +08:00
Stephen Chung
f4a528a88a Add release notes. 2020-05-18 09:36:34 +08:00
Stephen Chung
8b5550eeb6 Complete StaticVec implementation. 2020-05-17 22:19:49 +08:00
Stephen Chung
a2c50879fe Fix dropping issues with StaticVec and use it everywhere. 2020-05-17 00:24:07 +08:00
Stephen Chung
0cb781c1aa Avoid allocation in Target. 2020-05-16 11:42:56 +08:00
Stephen Chung
be97047e51 Limit modules loading. 2020-05-15 21:40:54 +08:00
Stephen Chung
55c97eb649 Add progress tracking and operations limit. 2020-05-15 11:43:32 +08:00
Stephen Chung
5d5ceb4049 Consolidate all unsafe code under one single file. 2020-05-14 18:27:22 +08:00
Stephen Chung
5c61827c7c Force-cast local variable names when pushing into scope. 2020-05-14 11:21:56 +08:00
Stephen Chung
cabceb7498 Better handling of errors during function calls. 2020-05-13 21:58:38 +08:00
Stephen Chung
9d8d074940 Consistent naming of methods. 2020-05-13 20:22:05 +08:00
Stephen Chung
30e5e2f034 Use modules to implement packages. 2020-05-13 19:21:42 +08:00
Stephen Chung
8e8816cb0c Add compile_scripts_with_scope. 2020-05-13 11:57:07 +08:00
Stephen Chung
996a54279c Pre-calculate property getter/setter function names. 2020-05-13 10:19:18 +08:00
Stephen Chung
ec67879759 Derive more standard traits. 2020-05-12 18:48:25 +08:00
Stephen Chung
03c64688ad Fix sync feature. 2020-05-12 16:32:22 +08:00
Stephen Chung
33c9be7efc Reformat. 2020-05-11 23:48:50 +08:00
Stephen Chung
414f3d3c23 Fix bug with calling a pure function method-call style. 2020-05-11 18:55:58 +08:00
Stephen Chung
4a8710a4a9 Create NativeCallable trait. 2020-05-11 13:36:50 +08:00
Stephen Chung
8aa0e2ceb4 Use StaticVec to avoid most allocations with function arguments. 2020-05-10 21:25:47 +08:00
Stephen Chung
974512d650 Use StaticVec to build arguments list. 2020-05-10 16:56:17 +08:00
Stephen Chung
80debbc432 Refactor. 2020-05-10 00:19:13 +08:00
Stephen Chung
a7bfac21bd Reducing boxing and sizes of Expr/Stmt. 2020-05-09 21:46:38 +08:00
Stephen Chung
17e4adc049 Move hash calculation out of loop. 2020-05-09 16:21:11 +08:00
Stephen Chung
79f39bd702 Pre-calculate function call hashes. 2020-05-09 16:15:50 +08:00
Stephen Chung
0d20137d6c Implement private modifier for functions. 2020-05-09 11:29:30 +08:00
Stephen Chung
d1de84fdd2 Add comments and fix documentation. 2020-05-09 10:00:59 +08:00
Stephen Chung
e50fcc385f Pre-calculate index for module-qualified calls. 2020-05-08 22:38:56 +08:00
Stephen Chung
eb52bfa28a Add export statement. 2020-05-08 16:49:24 +08:00
Stephen Chung
89d75b1b11 Fix compilation errors for no_module. 2020-05-08 14:50:48 +08:00
Stephen Chung
e0745ef069 Do not build index for multiple packages to avoid Engine creation regression. 2020-05-08 13:27:51 +08:00
Stephen Chung
e6fabe58cc Unify function hash calculations, pre-hash module-qualified function calls. 2020-05-08 11:34:56 +08:00
Stephen Chung
5f12391ec6 Use hashed lookup for module-qualified functions and variables. 2020-05-08 00:19:08 +08:00
Stephen Chung
c607c7c428 Move Engine functions and iterators lib to Packages API. 2020-05-07 15:25:50 +08:00
Stephen Chung
fb64adca93 Move fn_lib into State, and use StaticVec for function call arguments in dotting/indexing chains. 2020-05-07 10:00:10 +08:00
Stephen Chung
34327f6e54 Avoid copying arguments in packages. 2020-05-06 23:52:47 +08:00
Stephen Chung
d75a8bc6cd Make sure all features compile correctly. 2020-05-06 19:45:17 +08:00
Stephen Chung
88fec57394 Make module_resolver optional and remove NullModuleResolver. 2020-05-06 16:09:44 +08:00
Stephen Chung
c9571d375a Add position to script error. 2020-05-06 00:09:04 +08:00
Stephen Chung
82e1af7acd Implement module resolvers. 2020-05-05 23:57:25 +08:00
Stephen Chung
a1bcc5cd7d Merge branch 'master' into namespace 2020-05-05 20:42:16 +08:00
Stephen Chung
f081040767 Add support for custom type indexers. 2020-05-05 20:38:48 +08:00
Stephen Chung
aae9e43109 Implement module-qualified functions. 2020-05-05 17:51:40 +08:00
Stephen Chung
38e717a838 Build Module type plus engine hooks. 2020-05-05 15:00:10 +08:00
Stephen Chung
c03b162b7e Refactor code base and split into more module files. 2020-05-05 12:24:13 +08:00
Stephen Chung
143861747d Rename sub-scope/SubScope to module. 2020-05-05 10:39:12 +08:00
Stephen Chung
64036f69ca Refine modules. 2020-05-04 23:07:42 +08:00
Stephen Chung
2bdd174f16 Add import statement. 2020-05-04 19:36:58 +08:00
Stephen Chung
b94fa31e21 Merge branch 'master' into namespace 2020-05-04 18:06:39 +08:00
Stephen Chung
798e1df298 Do not error when a property is read-only. 2020-05-04 18:06:09 +08:00
Stephen Chung
ead9716f6d Add namespacing syntax. 2020-05-04 17:43:54 +08:00
Stephen Chung
4bf07182dc Merge branch 'namespace' of https://github.com/schungx/rhai into namespace 2020-05-04 10:42:57 +08:00
Stephen Chung
7da9d265d3 Avoid copying parameters for function calls. 2020-05-04 10:41:58 +08:00
jhwgh1968
7011e4068f Start on namespaces 2020-05-03 12:19:01 -05:00
Stephen Chung
3d05cc96cd Remove downcast_XXX from Variant. 2020-05-03 22:17:28 +08:00
Stephen Chung
d83b829810 Avoid copying arguments for function calls. 2020-05-03 16:54:24 +08:00
Stephen Chung
fc99b981a1 Fix panic when string character index is OOB. 2020-05-01 23:39:55 +08:00
Stephen Chung
c7c7fe3dfc Reduce size of Expr and Stmt by Boxing strings. 2020-05-01 17:32:39 +08:00
Stephen Chung
4f91e7fbcf Avoid copying in Dynamic. 2020-04-30 22:52:36 +08:00
Stephen Chung
21c3edb31e Streamline. 2020-04-29 16:11:54 +08:00
Stephen Chung
304c658f89 Use scope offset for variable access. 2020-04-28 23:05:03 +08:00
Stephen Chung
9ad9dd52ab Reduce unnecessary Cow's in Expr. 2020-04-28 19:39:36 +08:00
Stephen Chung
d3a97dc86b Remove EntryRef from Scope. 2020-04-27 22:49:09 +08:00
Stephen Chung
d043300ae2 Reduce unnecessary Option's. 2020-04-27 21:28:31 +08:00
Stephen Chung
43fdf3f962 FunctionsLib always exist. 2020-04-27 20:43:55 +08:00
Stephen Chung
b3e4659790 Encapsulate index values into StaticVec type. 2020-04-27 20:25:20 +08:00
Stephen Chung
5afeba6fd1 No need to return value for Scope::get. 2020-04-27 11:24:58 +08:00
Stephen Chung
07c5abcc02 Remove RefCell in Scope. 2020-04-27 09:36:31 +08:00
Stephen Chung
ce121ed6af Add comments and minor refactor. 2020-04-26 21:48:49 +08:00
Stephen Chung
f5c7d7cd0d Reduce memory footprint of Target. 2020-04-26 19:37:32 +08:00
Stephen Chung
33d3e34908 Deep linking for dot/index chains. 2020-04-26 18:04:07 +08:00
Stephen Chung
9998cf8890 Avoid copying iterator sources. 2020-04-24 22:54:56 +08:00
Stephen Chung
b6d839c8a9 Fix no_std build. 2020-04-24 12:39:24 +08:00
Stephen Chung
e7cc403381 Warn against eval in method-call style. 2020-04-23 13:22:28 +08:00
Stephen Chung
05bad53011 Encapsulate function calls and handle map property access more efficiently. 2020-04-23 10:21:02 +08:00
Stephen Chung
9a1c715aad Refine package API. 2020-04-22 14:55:40 +08:00
Stephen Chung
c69647d9fd Change Dynamic::from_xxx to From<xxx> impl. 2020-04-22 12:12:13 +08:00
Stephen Chung
69733688bf Make all public API's return Box<EvalAltResult> to reduce footprint. 2020-04-21 23:25:12 +08:00
Stephen Chung
0a75479637 Refine packages plumbing. 2020-04-21 23:01:10 +08:00
Stephen Chung
0306d15c04 Split core and standard libraries into packages. 2020-04-21 00:11:25 +08:00
Stephen Chung
b23fd6e20a Reshuffle code sections. 2020-04-19 18:33:02 +08:00
Stephen Chung
d3d62c7dd9 Anticipate number of functions to be registered. 2020-04-19 13:40:11 +08:00
Stephen Chung
a0bc49c867 Reduce size of Dynamic by boxing large types. 2020-04-18 11:10:03 +08:00
Stephen Chung
f5fff828e8 Box errors to reduce return type footprint. 2020-04-18 00:14:33 +08:00
Stephen Chung
5d9a99cefc Refine postfix operators handling. 2020-04-17 19:00:52 +08:00
Stephen Chung
3a93ab8240 Make FunctionsLib a HashMap. 2020-04-16 23:58:57 +08:00
Stephen Chung
f8e9d66a0b Remove lifetime from Engine. 2020-04-16 23:31:48 +08:00
Stephen Chung
4f2350734f Avoid copying indexed value if not necessary. 2020-04-16 12:08:28 +08:00
Stephen Chung
1ace4b474c Favor matching on Union's instead of downcast::<T>, as_xxx() or is::<T>. 2020-04-16 10:24:30 +08:00
Stephen Chung
c799a4567a Remove IndexSourceType. 2020-04-16 00:05:07 +08:00
Stephen Chung
a35518fe49 Split tokenizer into separate file, plus fix no_std feature. 2020-04-15 22:21:23 +08:00
Stephen Chung
5796e520ec Support Dynamic return values. 2020-04-13 10:27:08 +08:00
Stephen Chung
5152a40e93 Change Dynamic to enum. 2020-04-12 23:00:06 +08:00
Stephen Chung
bc0d43d68f Simplify code. 2020-04-11 18:09:03 +08:00