7d3f063e87
Merge branch 'next-token' into main
0.4.0-pre
2020-12-03 13:43:40 -08:00
4687300ad6
fix forward declaration using c11 features (???)
2020-12-03 13:38:46 -08:00
89c5e22480
add Num.tau
2020-12-03 13:20:15 -08:00
8361217369
Num; add min, max and clamp
2020-12-03 13:18:13 -08:00
38f50fe091
List; add swap(index0, index1)
2020-12-03 13:17:53 -08:00
62009870a8
List; add indexOf(value)
2020-12-03 13:17:26 -08:00
3d5e68fc01
Added List.sort(comp) to List module ( #802 )
2020-12-03 11:59:07 -08:00
08d2fa3821
fix paste issues from https://github.com/wren-lang/wren/pull/798/
2020-12-03 11:55:31 -08:00
d8bdc7359e
Added myself to the authors file ( #856 )
2020-12-03 11:51:48 -08:00
76fb4f311b
Test static operators ( #798 )
...
In #797 it was stated that static operators are valid in Wren, and proposed to check this behavior
2020-12-03 11:47:42 -08:00
84b29e6995
Add userData pointer to reallocateFn ( #788 )
...
* Add userData ptr to all reallocateFn calls
* Check that userData is correctly passed
* Update AUTHORS
2020-12-03 11:46:22 -08:00
a11d66cbd3
WIP wren/core: Add DEF_NUM_CONSTANT (with Num::infinity and Num::nan). ( #781 )
...
* wren/vm: Add "wren_math.h".
* wren/core: Add DEF_NUM_CONSTANT.
* wren/core: Add `Num::infinity` constant.
* wren/core: Add `Num::nan` constant.
2020-12-03 11:37:53 -08:00
59ee326523
Added a quick explanation of the continue keyword ( #854 )
...
* Added a quick explanation of the continue keyword
2020-12-03 11:29:52 -08:00
182ca90b8c
add wrenHasVariable and wrenHasModule
2020-12-03 11:13:04 -08:00
bc7dd50a54
fix warning
2020-12-03 10:47:49 -08:00
97ebcc72c3
Add wrenSetListElement, correctly allow negative indices on wrenGetListElement
2020-12-03 10:30:47 -08:00
999acba06f
bump version to 0.4.0, since that's the one we're working on
2020-12-03 09:41:27 -08:00
5264b46246
Fix outdated comment
2020-12-03 09:40:56 -08:00
3e0f71b742
[0.4.0] Import as ( #775 )
...
* Add import "..." for Variable as OtherName
2020-12-03 09:34:36 -08:00
6bd2f810e2
[0.4.0] Introduce WrenLoadModuleResult, fix unfreed strings from host. ( #778 )
2020-12-03 09:27:54 -08:00
e7071fffa5
Update AUTHORS ( #855 )
...
@ruby0x1 suggested I add my name to the AUTHORS file
2020-12-03 08:58:46 -08:00
55b926410d
Add continue statement ( #822 )
...
Note that documentation is still required.
2020-12-03 08:30:36 -08:00
f5339993ce
Add support for Fiber.try(_) ( #835 )
...
* Add support for Fiber.try(_)
* Add documentation for Fiber.try(_)
* Add another test for Fiber.try(_)
2020-12-03 08:21:37 -08:00
473392a56a
docs: fix simple typo, similiar -> similar ( #843 )
...
There is a small typo in src/vm/wren_value.h.
Should read `similar` rather than `similiar`.
2020-12-03 08:19:19 -08:00
556eeac86e
Fix broken link ( #799 )
...
The Variables guide linked to `/modules.html`, but the page talking about modules is `/modularity.html`
2020-11-25 22:49:52 -08:00
94e4888b6a
Fix link in null.markdown ( #848 )
2020-11-25 21:09:37 -08:00
44d6d20586
Do not allow inheriting built-in classes Num, Bool and Null ( #831 )
...
* Do not allow inheriting `Num`, `Bool` and `Null`. fixes #830
2020-10-26 08:39:36 -07:00
ad4e039187
Fix svg link to travis build ( #828 )
2020-10-17 15:57:39 -07:00
3c475f01ee
allow newline before dot for subscript as well, and add to tests
2020-09-19 22:03:16 -07:00
4c496c56a6
allow a newline before dot usage, for chained/fluent interfaces
2020-09-19 20:40:24 -07:00
1c5ac28831
compiler now tracks next token (in addition to current/previous)
2020-09-19 20:40:24 -07:00
45c67fae0c
Fn call: move arity check into interpret loop, which avoid the expensive if after the call, since runtime errors originating inside the call itself will still be handled, we only have the one emitted from call itself.
...
This brings the benchmark back up to where it was.
2020-09-18 15:42:37 -07:00
beae242a41
vm; handle errors from fn.call (still investigating)
2020-09-18 13:11:12 -07:00
86463acb90
Fix stack corruption caused by Fn call primitives ( #807 )
...
Excerpt from @munificent on the nature of the bug:
In runInterpreter, for performance, the vm caches an IP pointing into some bytecode.
All primitives except for `.call`, do not touch Wren's own callstack. They run a little C code and return, so the array of CallFrames, their IPs, and the IP cached inside run() are not affected at all.
While runInterpreter() is running, the IP in the top CallFrame is not updated, so it gets out of sync. This is deliberate, since storing to a field is slow, but it means the value of that field is stale and doesn't represent where execution actually is at that point in time.
To get that field in sync, we use STORE_FRAME(), which stores the local IP value back into the IP field for the top CallFrame. The interpreter is careful to always call STORE_FRAME() before executing any code that pushes a new CallFrame onto the stack.
In particular, if you look around, you'll see that every place the interpreter calls wrenCallFunction() is preceded by a STORE_FRAME(). That is, except for the call to wrenCallFunction() in the call_fn() primitive. That's the bug.
The .call() method on Fn is special because it does modify the Wren call stack and the C code for that primitive directly calls wrenCallFunction(). When that happens, the correct IP for the current function, which lives only in runInterpreter()'s local variable gets discarded and you're left with a stale IP in the CallFrame.
Giving the function call primitives a different method type and having the case for that method type call STORE_FRAME() before invoking the primitive fixes the bug.
2020-09-18 12:32:43 -07:00
f769599bc6
docs; fix random module docs missing a closing tag (thanks @totallyRonja)
2020-08-29 12:03:46 -07:00
039150efeb
docs; fix example formatting
2020-07-30 09:24:23 -07:00
81bfbfce23
fix issue with docs clearing the writeFn from the config. add complete embedding example to docs + repo
2020-07-30 09:09:15 -07:00
dead8df82e
GC debug times are easier to reason about when printed in milliseconds, rather than seconds
2020-07-18 20:50:26 -07:00
b279e51fd1
Allow computed goto when using clang on Windows
...
Clang defines _MSC_VER for compatibility with MSVC, but that can often create problems for code that assumes MSVC only.
2020-07-18 20:41:16 -07:00
286162365a
update wip 0.4.0 changelog
2020-07-18 20:26:23 -07:00
5b0f8740f2
Revert "Extended test for Random.sample to cover both branches ( #715 )"
...
This reverts commit f81cb5d23c .
2020-07-18 20:10:22 -07:00
f81cb5d23c
Extended test for Random.sample to cover both branches ( #715 )
...
I've verified that this test fails without the fix in change
186a8c7c13 .
See issue #713
2020-07-14 20:15:12 -07:00
54b4c233b9
test: Fix some tests so they fail on expected error, not on syntax error. ( #779 )
2020-07-14 20:14:08 -07:00
58611240e7
Remove magic values as exit codes in test application ( #777 )
2020-07-11 13:30:43 -07:00
a3f5b3d98f
wren/vm: Allow wrenInterpret to call foreign function (complement 344d343 at fixing #730 ). ( #764 )
2020-07-11 13:05:22 -07:00
da091e250c
set WREN_MAX_TEMP_ROOTS default to 8 instead of 5
...
that's 64 bytes, fits nicely in a cache line and isn't _as_ arbitrary.
2020-07-11 11:34:35 -07:00
2ce421eac5
use push root instead of a handle for module GC protection
...
related to d432b03d62
2020-07-11 11:30:52 -07:00
d432b03d62
fix many module imports causing GC to pull the rug on our module instance
2020-07-10 20:00:17 -07:00
433fbc4019
core; num; add exp & log2
...
I've had a couple use cases in time that the code is significantly clearer with these, and makes porting less error prone
2020-07-10 19:38:45 -07:00
0e8d56f874
add a note about switched goto for future reference
2020-07-10 19:15:21 -07:00