Commit Graph

767 Commits

Author SHA1 Message Date
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
Stephen Chung
37dbc68bf5 Use target_family for wasm. 2022-01-12 08:12:28 +08:00
Stephen Chung
efd57c600b Add test for literal operations. 2022-01-10 13:29:22 +08:00
Stephen Chung
d15470fd4b Change eval<()> to run. 2022-01-10 13:26:33 +08:00
Stephen Chung
683cf31de2 Add more tests. 2022-01-09 17:26:46 +08:00
Stephen Chung
d1749131c5 Add missing data size check. 2022-01-08 23:23:43 +08:00
Stephen Chung
c75d51ae88 Reduce unnecessary data size checking. 2022-01-06 22:10:16 +08:00
Stephen Chung
97295a66da Fix test. 2022-01-05 13:24:52 +08:00
Stephen Chung
328f6910b6 Refactor wasm feature gates. 2022-01-04 22:16:20 +08:00
Stephen Chung
135b1f54c2 Remove Option from source and use empty string as no source. 2022-01-01 17:20:00 +08:00
Stephen Chung
7ed91eadc0 Fix blob test. 2021-12-31 19:34:43 +08:00
Stephen Chung
c4c4696964 Fix builds. 2021-12-31 18:55:48 +08:00
Stephen Chung
f3a8364936 Split blob write into write_utf8 and write_ascii. 2021-12-31 17:49:38 +08:00
Stephen Chung
e3aa2c19ce Make for loops for efficient. 2021-12-31 15:59:13 +08:00
Stephen Chung
80ccd52319 Add tests. 2021-12-30 12:23:35 +08:00
Stephen Chung
cbaf095c7a Merge restore_state and rewind_scope. 2021-12-28 17:50:49 +08:00
Stephen Chung
5729f0cdd4 Add test for call_fn_raw. 2021-12-19 23:22:14 +08:00
Stephen Chung
123012404b Add Blob::write for strings. 2021-12-18 23:03:35 +08:00
Stephen Chung
541ef319bb Merge branch 'v1.3-fixes' 2021-12-18 18:22:20 +08:00
Stephen Chung
ac8324ae41 Fix no_object build. 2021-12-18 18:08:48 +08:00
Stephen Chung
aa8cc8f719 Fix builds. 2021-12-18 17:59:32 +08:00
Stephen Chung
7eda6454a8 Bug fix. 2021-12-18 17:47:35 +08:00
Stephen Chung
9736171089 Fix bug in hex parsing for negative numbers. 2021-12-18 17:07:30 +08:00
Stephen Chung
29a9b3878d Fix builds. 2021-12-17 16:32:34 +08:00
Stephen Chung
c7ec27acc7 Split AST into separate files. 2021-12-17 16:07:13 +08:00
Stephen Chung
b1b2c62d7d Merge branch 'v1.3-fixes' 2021-12-16 22:40:25 +08:00
Stephen Chung
10fa6844c4 Fix custom syntax with method calls. 2021-12-16 22:40:10 +08:00
Stephen Chung
fbc2b1f13d Allow non-custom reserved symbols in custom syntax. 2021-12-16 18:01:49 +08:00
Stephen Chung
f92cbe1f6d Merge branch 'v1.3-fixes' 2021-12-16 16:10:39 +08:00
Stephen Chung
224aa0ea68 Allow custom syntax inside binary operator expressions. 2021-12-16 16:06:44 +08:00
Stephen Chung
ef14079c61 Add ranges. 2021-12-15 12:06:17 +08:00
Stephen Chung
5eaf85254f Fix builds. 2021-12-12 17:26:15 +08:00
Stephen Chung
6af406bafc Add parse/write to blobs. 2021-12-12 16:29:54 +08:00
Stephen Chung
675ddb89f9 Add "" and `` in string literals. 2021-12-09 13:34:51 +08:00
Stephen Chung
4421f33b2c Fix bug in blob's. 2021-12-07 19:03:04 +08:00
Stephen Chung
b8c4054c20 Add strict variables mode. 2021-12-04 17:57:28 +08:00
Stephen Chung
ff4827064b Fix build. 2021-12-03 11:52:34 +08:00
Stephen Chung
fd26654125 Add allow_looping. 2021-12-03 11:24:38 +08:00
Stephen Chung
7cd76c6d18 Add language options. 2021-12-03 11:16:35 +08:00
Stephen Chung
41dd989866 Support deserialization into byte arrays for BLOB's via serde_bytes. 2021-12-02 14:10:53 +08:00
Stephen Chung
5363b0724f Support Option in from_dynamic. 2021-12-02 12:50:11 +08:00
Stephen Chung
d36e2d22d1 Minor refactor. 2021-12-02 12:49:46 +08:00
Stephen Chung
ba0a6c667e Add FnPtr::call_within_context. 2021-11-29 12:43:59 +08:00
Stephen Chung
95dc2ad502 Remove fields and parameters under no_function. 2021-11-29 09:43:35 +08:00
Stephen Chung
dca47d5233 Remove volatile warnings for types and functions exposed unter internals. 2021-11-28 22:03:02 +08:00
Stephen Chung
f49ff28b82 Fix test. 2021-11-28 10:49:48 +08:00
Stephen Chung
30bfdd841a Add FnPtr::call. 2021-11-27 16:28:34 +08:00
Stephen Chung
dc7444596b Add test for capturing closures in array method. 2021-11-23 22:56:31 +08:00
Stephen Chung
a757dfe89d Add blobs. 2021-11-23 14:58:54 +08:00
Stephen Chung
6ad7b344bf Add into_array and into_typed_array. 2021-11-23 12:45:59 +08:00
Stephen Chung
de906053ed Deprecate call_fn_dynamic into call_fn_raw. 2021-11-15 11:13:00 +08:00
Stephen Chung
615c3acad6 Use actual outer scope for function-bang calls. 2021-11-14 22:48:57 +08:00
Stephen Chung
6b27ca19d5 Add function call bang test. 2021-11-10 22:10:03 +08:00
Stephen Chung
c8b59bd9ca Fix test. 2021-11-08 23:24:03 +08:00
Stephen Chung
5083df3096 Propagate constants to functions for Engine::XXX_with_scope calls. 2021-11-08 22:16:28 +08:00
Stephen Chung
09e6b21729 Move mutable runtime global state to Imports. 2021-11-08 09:27:08 +08:00
Stephen Chung
71ad158b6a Fix builds. 2021-11-07 18:25:32 +08:00
Stephen Chung
68c0ee08c0 Reduce usage of Default::default() to make it easier to refactor. 2021-11-07 18:12:37 +08:00
Stephen Chung
61cc3d0bf2 Merge branch 'v1.1-fixes' 2021-11-05 23:26:00 +08:00
Stephen Chung
eeca8c90aa Make sure the global namespace is always searched first. 2021-11-05 23:22:05 +08:00
Stephen Chung
affbb81d8a Add NativeCallContext::position. 2021-11-05 19:35:33 +08:00
Stephen Chung
5e275d4593 Fix no_function build. 2021-10-29 18:14:07 +08:00
Stephen Chung
00659d65d9 Implement global module in EvalState. 2021-10-27 17:52:48 +08:00
Stephen Chung
79dd3f8186 Add $$ marker to custom syntax. 2021-10-25 22:41:42 +08:00
Stephen Chung
9d1ab2c8a1 Add test for parsing overflow. 2021-10-18 16:40:54 +08:00
Stephen Chung
b091fea17b Add event handler test. 2021-10-16 13:59:12 +08:00
Stephen Chung
87d48948f9 Merge branch 'bug-fixes' 2021-09-28 16:55:33 +08:00
Stephen Chung
7ce8887343 Fix no_index build. 2021-09-28 16:36:31 +08:00
Stephen Chung
85dcd6e754 Fix bug with changing property of value obtained via index getter. 2021-09-28 15:59:46 +08:00
Stephen Chung
c4a00f5269 Change consume to run. 2021-09-27 10:59:38 +08:00
Stephen Chung
fe47058add Merge branch 'bug-fixes' 2021-09-27 10:34:46 +08:00
Stephen Chung
6df2178460 Assume property getters are pure. 2021-09-27 10:34:24 +08:00
Stephen Chung
6e7fbfa66f Add pop to string. 2021-09-20 16:25:23 +08:00
Stephen Chung
cbe08fb64e Merge branch 'bug-fixes' 2021-09-03 10:19:58 +08:00