Commit Graph

247 Commits

Author SHA1 Message Date
Stephen Chung
a82f0fc738 Allow non-Dynamic in return_raw. 2021-03-22 11:18:09 +08:00
Stephen Chung
b3bcd7bf79 Fix codegen test. 2021-03-22 10:08:43 +08:00
Stephen Chung
aa0594210c Use RhaiResult for plugin return. 2021-03-19 10:30:30 +08:00
Stephen Chung
d0922adb5b Deprecate RegisterFn and RegisterResultFn. 2021-03-15 11:36:30 +08:00
Stephen Chung
f3b5df09af Fix codegen test results. 2021-02-26 20:14:23 +08:00
Stephen Chung
33fa57d95b Refine codegen error positions. 2021-02-26 20:00:25 +08:00
Stephen Chung
37fe14ba16 Raise error if pure misuse. 2021-02-26 18:28:21 +08:00
Stephen Chung
823ecef1f1 #[rhai_fn(pure)] must have &mut parameter. 2021-02-26 17:19:40 +08:00
Stephen Chung
2f78626a21 Update README. 2021-02-25 17:53:01 +08:00
Stephen Chung
067983bb57 Fix codegen tests. 2021-02-21 15:44:01 +08:00
Stephen Chung
dd3b16403f Code cleanup. 2021-02-21 14:11:19 +08:00
Stephen Chung
fc7697d504 Reflect visibility to generated modules. 2021-02-21 13:51:24 +08:00
Stephen Chung
ac1b7debe9 Add pure function attribute. 2021-02-19 23:13:41 +08:00
Stephen Chung
61d7356e08 Reduce spelling warnings in codegen. 2021-02-18 17:42:49 +08:00
Stephen Chung
4815de3634 Fix codegen test error display. 2021-02-09 14:34:51 +08:00
Stephen Chung
7fc38d4cd2 Change rhaiscript.github.io to rhai.rs 2021-01-30 07:19:54 +08:00
Stephen Chung
9e2c1a5860 Bump version. 2021-01-15 19:55:14 +08:00
Stephen Chung
8c47d61456 Refine documentation and comments. 2021-01-11 23:09:33 +08:00
Stephen Chung
96b1e7777b Update URL links. 2021-01-07 17:30:06 +08:00
Stephen Chung
67a85a19ae Fix codegen test. 2021-01-06 19:30:58 +08:00
Stephen Chung
e059ca009c Fix feature builds. 2021-01-06 18:22:45 +08:00
Stephen Chung
fba2dd7a84 Bump version. 2020-12-30 15:17:16 +08:00
Stephen Chung
dc4e52e795 Code enhancements. 2020-12-26 13:05:57 +08:00
Stephen Chung
809b813def Simplify codegen. 2020-12-24 21:28:40 +08:00
Stephen Chung
9fd7e01197 Simplify code. 2020-12-23 23:29:19 +08:00
Stephen Chung
746a0b186f Fix typo. 2020-12-23 15:15:47 +08:00
Stephen Chung
f55a56c6bc Engine::register_global_module and Engine::register_static_module must be passed shared Module. 2020-12-23 10:08:43 +08:00
Stephen Chung
15fb03218c Rename packages to global modules. 2020-12-22 23:45:14 +08:00
Stephen Chung
95b8dcc623 Update docs. 2020-12-16 14:57:28 +08:00
Stephen Chung
4c4a209609 Fix tests. 2020-11-30 21:16:59 +08:00
Stephen Chung
65a4ceb3be Getters/setters and indexers in a plugin module are default global. 2020-11-30 00:52:21 +08:00
Stephen Chung
8d410dfc71 Add return type to function metadata. 2020-11-22 22:15:17 +08:00
Stephen Chung
07fe132e1a Add gen_fn_siguatures API. 2020-11-22 17:21:34 +08:00
Stephen Chung
e5c9ca23b5 Build index when creating a module. 2020-11-21 22:18:32 +08:00
Stephen Chung
863c6b45a5 Fine tune codegen for global exports. 2020-11-17 14:29:28 +08:00
Stephen Chung
bd094d95b4 Fix codegen doc error. 2020-11-17 13:11:31 +08:00
Stephen Chung
df72d324ba Fix tests. 2020-11-17 12:40:12 +08:00
Stephen Chung
a19865d811 Add global/internal parameters to rhai_fn. 2020-11-17 12:09:56 +08:00
Stephen Chung
c919ee4e46 Fine tune hash map sizes. 2020-11-15 13:49:54 +08:00
Stephen Chung
cbd7ed2ca7 Fix test. 2020-10-28 22:30:35 +08:00
Stephen Chung
2c7c719cd5 Minor cleanup before release. 2020-10-22 12:26:44 +08:00
Stephen Chung
09f8b13f2d Fix test output. 2020-10-20 11:10:46 +08:00
Stephen Chung
643ecc86a3 Minor refactor 2020-10-20 09:21:41 +08:00
Stephen Chung
46b92c9d1f Allow NativeCallContext in function arguments. 2020-10-18 21:47:34 +08:00
Stephen Chung
29374a8ce7 Update version. 2020-10-16 17:48:50 +08:00
Stephen Chung
a6fa94d946 Rhai function names with $ and . no longer fail. 2020-10-15 14:36:10 +08:00
Stephen Chung
8abb3c5203 Fix ui tests. 2020-10-15 14:06:54 +08:00
Stephen Chung
3c9250b0bf Skip wrapping if function returns Dynamicc. 2020-10-15 13:28:22 +08:00
Stephen Chung
d35c216465 Add README's. 2020-10-07 22:56:21 +08:00
Stephen Chung
0ba219352d Make doc tests runnable. 2020-10-07 22:51:43 +08:00
Stephen Chung
e8d5f78f88 Simplify code. 2020-10-01 23:31:27 +08:00
Stephen Chung
45a290f0ea Change doc test from no_run to ignore. 2020-09-30 23:39:46 +08:00
Stephen Chung
2290c72de1 Fix tests. 2020-09-30 23:27:41 +08:00
Stephen Chung
a04ed02b54 Simplify macro system and update doc comments. 2020-09-30 22:55:40 +08:00
Stephen Chung
ea78fa2b27 Change SharedPluginFunction to Shared<FnPlugin> 2020-09-29 13:06:48 +08:00
Stephen Chung
91886e30d2 Fix test output. 2020-09-26 12:28:28 +08:00
Stephen Chung
984ef48741 Fix test. 2020-09-26 12:17:16 +08:00
Stephen Chung
0d7d54e21c Simplify rename checking. 2020-09-26 12:08:15 +08:00
Stephen Chung
371b7fd00b Fix tests. 2020-09-26 00:46:47 +08:00
Stephen Chung
a2551a4650 Check rename collisions with special names. 2020-09-26 00:30:30 +08:00
Stephen Chung
6b13e266b9 Allow actual function name that is the same as a #[rhai_fn(name = "...")] rename. 2020-09-25 23:07:18 +08:00
Stephen Chung
5718f454c4
Merge pull request #60 from jhwgh1968/plugins
Remove redundant clones in codegen
2020-09-23 11:54:57 +08:00
J Henry Waugh
d65042088e Remove redundant clones in codegen 2020-09-22 21:38:59 -05:00
Stephen Chung
235ad66d2b Flatten types in functions. 2020-09-22 22:19:21 +08:00
Stephen Chung
5a37497a22 Flatten type groups and types in parentheses. 2020-09-22 21:29:44 +08:00
J Henry Waugh
c389014df7 Run cargo fmt for loose ends 2020-09-20 12:40:21 -05:00
Stephen Chung
3a98567139 Use take_string. 2020-09-20 14:29:10 +08:00
Stephen Chung
d8d3b52d64 Merge branch 'plugins_dev' of https://github.com/schungx/rhai into plugins_dev 2020-09-20 14:25:31 +08:00
Stephen Chung
2ba875a177 Use take_string for &str and String parameters. 2020-09-20 14:23:14 +08:00
Stephen Chung
bf245a798b Enable String parameters. 2020-09-20 10:51:37 +08:00
Stephen Chung
cfe28c9282 Remove Position parameter from plugin call function. 2020-09-20 10:51:37 +08:00
Stephen Chung
7c3498a4e1 Prevent errors when using alternative error printout style. 2020-09-20 10:51:37 +08:00
Stephen Chung
20a453b3cc Enable String parameters. 2020-09-19 18:18:40 +08:00
Stephen Chung
fe718fea39 Remove Position parameter from plugin call function. 2020-09-18 13:59:38 +08:00
Stephen Chung
23b5bc4bd9 Prevent errors when using alternative error printout style. 2020-09-18 12:31:41 +08:00
Stephen Chung
92be487e80 Implement constants via calling the constant. 2020-09-17 20:27:45 -05:00
Stephen Chung
c07c4561eb Remove unused_variables. 2020-09-17 20:27:45 -05:00
Stephen Chung
5e4ba9c016 Swich back to assert_eq! for token stream tests. 2020-09-17 20:27:45 -05:00
Stephen Chung
3dc599c936 Streamline rhai_generate. 2020-09-16 21:53:22 -05:00
Stephen Chung
7ceb624ec1 Add combine_with_exported_module. 2020-09-16 21:53:22 -05:00
Stephen Chung
c63f30a6a2 Fix tests. 2020-09-16 21:53:22 -05:00
Stephen Chung
52298bd96c Streamline rhai_generate. 2020-09-16 21:53:22 -05:00
Stephen Chung
654da2db8a Fix tests. 2020-09-16 21:53:22 -05:00
Stephen Chung
d57ce9c050 Remove warning about unused constants in modules. 2020-09-16 21:53:22 -05:00
Stephen Chung
6dc5a81d53 Add cast to type for constants to avoid mis-typing. 2020-09-16 21:50:49 -05:00
Stephen Chung
848bdf3f01 Add combine_with_exported_module. 2020-09-16 21:50:44 -05:00
J Henry Waugh
381e80179e Re-bless ui tests 2020-09-12 22:57:17 -05:00
J Henry Waugh
b1f23ac3ed Enforce signatures on user get/set/index functions 2020-09-12 22:48:40 -05:00
J Henry Waugh
0a2f93439e Reorganize get/set/index code into FnSpecialAccess 2020-09-12 22:48:34 -05:00
J Henry Waugh
335d853060 Unit tests for rename + getter/setter/indexer 2020-09-12 22:46:45 -05:00
J Henry Waugh
18032ab8a0 Unit test for multiple renames 2020-09-12 22:46:45 -05:00
J Henry Waugh
cecf3dd585 Unit tests for index getters and setters 2020-09-12 22:46:45 -05:00
J Henry Waugh
b74923a63c Unit tests for property getters and setters 2020-09-12 22:46:45 -05:00
J Henry Waugh
43969a7bee Forbid $ in renames 2020-09-12 22:46:45 -05:00
J Henry Waugh
6e701bfe83 Catch getter, setter, indexer errors 2020-09-12 22:46:45 -05:00
Stephen Chung
b311688fee Fix test. 2020-09-11 22:56:19 +08:00
Stephen Chung
36fe02558e Fix tests output. 2020-09-11 22:45:15 +08:00
Stephen Chung
d527ef7dbf Remove SC from codegen authors, add jhwgh1968 to Rhai authors. 2020-09-09 09:12:28 +08:00
J Henry Waugh
229475caef Add tests fixed by workspace 2020-09-08 16:04:04 -05:00
Stephen Chung
bd30edb877 Fix test output. 2020-09-07 17:08:47 -05:00
Stephen Chung
397acb4fce Add tests for multiple renames. 2020-09-07 17:08:41 -05:00
Stephen Chung
dbfd3df810 Support multiple names in rhai_fn. 2020-09-07 17:08:37 -05:00
J Henry Waugh
384152004e Split internal tests into their own files 2020-09-06 15:25:01 +08:00
J Henry Waugh
9882b97fca Fix trybuild tests for latest nightly 2020-09-06 15:25:01 +08:00
J Henry Waugh
0b3fef6651 Add nested module export_prefix test 2020-09-02 20:31:22 -05:00
J Henry Waugh
5585405bdc Make export_prefix use fn name not export name 2020-09-02 20:10:52 -05:00
J Henry Waugh
3af49cec70 Implement export_* attributes for macros 2020-09-01 23:15:28 -05:00
J Henry Waugh
e66adaa60f Revert diagnostic tests which trigger trybuild path bug 2020-08-27 23:33:46 -05:00
J Henry Waugh
d8e85df9dc Add return_raw tests for rhai_fn in module 2020-08-27 23:13:44 -05:00
J Henry Waugh
62dc142c58 Avoid bypassing setter checks by making fn.params.skip private 2020-08-27 23:13:44 -05:00
J Henry Waugh
fedc4c5338 Add exported_fn tests for rhai_fn in module 2020-08-27 23:13:44 -05:00
J Henry Waugh
8de095fa36 Improve diagnostics for non-clonable return types 2020-08-27 23:13:44 -05:00
J Henry Waugh
525ffe6f5a Improve diagnostics for duplicated names 2020-08-27 23:13:44 -05:00
J Henry Waugh
5498443517 Major refactor of attribute handling 2020-08-23 17:53:37 -05:00
J Henry Waugh
bb6a044182 Add test case for overloading rename 2020-08-23 17:49:50 -05:00
J Henry Waugh
3fd3da6bfc Improve diagonstics on return_raw return mismatches 2020-08-23 17:24:18 -05:00
J Henry Waugh
7c273e0aac Add missing skip submodule test 2020-08-23 17:24:18 -05:00
J Henry Waugh
65009dd193 Block #[cfg] attributes on inner constants 2020-08-21 23:26:25 -05:00
J Henry Waugh
55870e7b37 Add #[cfg] support in submodules 2020-08-21 23:26:25 -05:00
J Henry Waugh
382e60e91a Move UI tests to separate tests file 2020-08-21 23:26:25 -05:00
J Henry Waugh
708c0f385e Block #[cfg] attributes on exported or inner functions 2020-08-21 23:26:25 -05:00
J Henry Waugh
7962c6dc52 codegen: add rhai_mod and submodule support 2020-08-20 22:21:41 -05:00
J Henry Waugh
c87da31328 codegen: prevent name duplication in Rust or Rhai 2020-08-19 23:12:43 -05:00
J Henry Waugh
8efde3c7ce codegen: Rhai names cannot contain dot 2020-08-19 22:16:00 -05:00
J Henry Waugh
f1dc2cbf18 codegen: update tests for new name attribute behavior 2020-08-19 21:09:12 -05:00
Stephen Chung
767c39d974 Simplify rhai_fn attribute. 2020-08-17 23:35:04 +08:00
Stephen Chung
371c131395 Fix CI. 2020-08-17 09:44:28 +08:00
Stephen Chung
810514dd31 Add get/set/index_get/index_set parameters to rhai_fn. 2020-08-17 00:13:52 +08:00
Stephen Chung
e75d91e9bf Bring more functions into modules in plugins via rhai_fn(name) attribute. 2020-08-16 23:41:59 +08:00
Stephen Chung
31a05f8c48 Revise treatment of name parameter. 2020-08-16 18:24:42 +08:00
Stephen Chung
7eb75f6790
Merge pull request #35 from jhwgh1968/plugins
Convert args length check to debug assert
2020-08-16 11:29:03 +08:00
J Henry Waugh
bcf14025a7 Add rhai_fn nested attribute and skip fn parameter 2020-08-15 21:51:45 -05:00
J Henry Waugh
3ccc08b6e0 Convert args length check to debug assert 2020-08-15 14:25:19 -05:00
J Henry Waugh
7fcbfcc7fd codegen: explicit import of format! macro 2020-08-14 19:37:25 -05:00
J Henry Waugh
b27ebb318d Rearrange imports to support no_std 2020-08-13 23:04:30 -05:00
J Henry Waugh
e77dc4cc34 Fix missing import in test_functions 2020-08-13 22:07:37 -05:00
Stephen Chung
631c4be064 rhai::FnAccess -> FnAccess to enable use in internal code. 2020-08-13 14:57:23 +08:00
J Henry Waugh
28572544d8 Split register export macro, add Engine support 2020-08-12 23:36:35 -05:00
J Henry Waugh
6d11fdcd18 codegen: replace downcast_clone with more efficient mem::take 2020-08-11 19:05:52 -05:00
J Henry Waugh
07a4541949 export_fn: add return_raw attribute 2020-08-09 14:19:47 -05:00
J Henry Waugh
1df5d05239 export_fn: allow duplicate Rust names 2020-08-08 10:34:00 -05:00
J Henry Waugh
7410f40c92 export_fn: add "name" parameter 2020-08-07 21:19:23 -05:00
J Henry Waugh
be315aebaf Fix breakage due to write_lock() 2020-08-06 18:36:19 -05:00
Stephen Chung
dd6b6cd49f Fix codegen and tests to new API changes. 2020-08-06 14:10:27 +08:00
J Henry Waugh
3136188801 Improve proc macro hygiene 2020-08-02 19:27:35 -05:00
Stephen Chung
73cda2d4f9 rustfmt. 2020-08-02 15:39:08 +08:00
J Henry Waugh
d01203cb5d New Procedural Macros Crate v0.1 2020-08-01 11:52:32 -05:00