1
0
forked from Mirror/wren
Commit Graph

1042 Commits

Author SHA1 Message Date
e4b4df2e62 minor; remove redundant comment bit 2021-04-09 11:17:15 -07:00
d763c72e3d fix use of NULL_VAL, also invalid when nan tagging is disabled 2021-04-08 21:40:06 -07:00
34b01226a4 fix use of UNDEFINED_VAL which is invalid when nan tagging is disabled 2021-04-08 21:34:27 -07:00
a4ae905384 Introduce Attributes (#962)
* introduce Attributes for classes and methods
2021-04-08 21:30:09 -07:00
5244a9d001 Add an additional escape sequence \e. (#963) 2021-04-08 10:16:24 -07:00
e260b467c4 made wren version number accessable via function (#958) 2021-04-08 09:33:22 -07:00
1307bdfb64 value: Rename validateKeyTypeto wrenMapIsValidKey. (#965) 2021-04-08 09:10:55 -07:00
06b71897b0 Surface error messages for map key values in the API with asserts
closes https://github.com/wren-lang/wren/pull/921
2021-04-07 23:08:31 -07:00
059e407ed3 wren/compiler: Allow multiline empty parameter lists and calls. (#925) 2021-04-07 22:58:46 -07:00
e4052a25d7 wren/vm: Add wrenIsFalsyValue. (#866) 2021-04-07 22:54:49 -07:00
041f1bab8d Fix returning from constructors (#845)
* Fix returning from constructors

 1. Do not allow returning with a value
 2. Return the instance, correctly, even when the user returned explicitly

* revise error message for consistency, revise implementation details a bit, fix extra args to finishBody

* clarify tests a bit

* document constructor return

Co-authored-by: ruby0x1 <ruby0x1@pm.me>
2021-04-07 22:53:05 -07:00
68f5c096d8 Disallow non-Num arguments in Num for min(_), max(_), clamp(_,_), pow(_) and atan(_) (#859)
* Disallow non-Num arguments in `Num.min(_)`, `Num.max(_)`, `Num.clamp(_,_)`

Previously this was an Undefined Behavior

* also validate args for pow, atan2, add tests, fix error messages

Co-authored-by: ruby0x1 <ruby0x1@pm.me>
2021-04-07 22:04:58 -07:00
4847b37789 minor cleanup 2021-04-07 21:56:19 -07:00
28da4b449c Add Num.[max/min]SafeInteger (#874) 2021-04-07 21:45:00 -07:00
0be504832e fix code documentation 2021-04-07 18:36:11 -07:00
197c0ff4f9 fix loadModuleFn description in header 2021-04-06 19:49:40 -07:00
e3c76a3e76 Raw strings now ignore whitespace on both ends for consistency and clarity
added more tests, updated documentation
2021-04-04 22:28:57 -07:00
981ea4adf1 Add raw string literals
Also document + test multi line literals.
2021-04-04 13:52:32 -07:00
345f919e26 make WREN_API_DLLEXPORT required, fixes statically linked versions
-_-
2021-04-04 13:29:32 -07:00
33ab8be7e3 fix possibility of having no reallocate function (#954)
Before, if a config was provided it was expected to have a reallocate function, now it can remain null and the default will be used.
2021-04-04 11:24:48 -07:00
a501fba4bb add WREN_API declaration for proper symbol export
Brought up by @Orcolom

Detected for MSVC or similar and can be explicitly activated by defining WREN_API_DLLEXPORT (or manually defining WREN_API to __declspec( dllexport ) before include).

Can be disabled by using a blank `#define WREN_API` before include.

Note: to use the import variant, `#define WREN_API __declspec(dllimport)` before including the wren header.
2021-04-04 11:18:40 -07:00
ecce1f6be9 List; add remove(value)
Having to encode this behaviour at every call site is tedious. It makes a lot of sense to just have the method available on list itself.
2021-04-03 19:55:42 -07:00
208bbc02a5 revert #826
3a06580b89
2021-02-13 10:17:59 -08:00
9dfbc021a0 wren/compiler: Store value in the correct token. (#923) 2021-02-06 07:53:39 -08:00
3a06580b89 Don't use strtoll() with explicit base to parse hex, instead use strtod() (#826)
`strtod()` automatically recognizes the `0x` and converts to hex

This has two advantages:
 1. Simplify code (no need of argument `isHex` to `makeNumber`, no `if`)
 2. Allow numbers larger than `long long` if they fit into `double`
2021-01-30 21:44:52 -08:00
ce599259bc wren/core: Add Num::cbrt. (#905) 2021-01-30 21:13:58 -08:00
cb51d61a64 fix unmarked compiler value causing memory issues
https://github.com/wren-lang/wren/issues/869
2020-12-07 12:34:31 -08:00
9da1e265df Remove unused field skipNewlines (#858) 2020-12-03 19:53:26 -08:00
7d3f063e87 Merge branch 'next-token' into main 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
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
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
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
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
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