These checks run before any references to rule[x] to avoid reading
beyond the end of the buffer. This needs to happen inline, not only at
the end of the loop where we check if we landed on the correct ending
index.
This change makes it so top level signals in the main thread will result
in expected error codes. For spawned threads, we will default to
pthread_exit or ExitThread(-1) on Windows after a top level signal.
Using `(sandbox :exit)` will restore the old behavior where a top level
signal will just print an error and call pthread_exit leaving other
thread untouched.
This hides JanetMarshalContext behind an opaque pointer. User of this
struct should use the public API instead of using those internal
implementation details.
Usually, we try to pre-allocate a few extra stack values for
convenience, but we don't actually need to. Avoid a buffer overflow in
the case where this "extra" was causing us to go over INT32_MAX.
We make some assumptions about the index range of slots in emit.c that
is not tracked by the C type system, so add some asserts and conversions
to be safe.
Add some test cases and asserts for new pretty printing - we were not
properly handing the case when print formatter was not at the start of
the buffer.
A simple fix is to add a lookback_barrier, which is an index into the
buffer that backtracking print formatter can't go past. This ensures
that, whatever newlines are replace with spaces, we don't mess with any
explicit newlines that should be printed.
Also some tweaks to logic to try an make invariants more obvious and
simplify looping and indexing.
kqueue-based filewatch is more limited than inotify, but is still
useful in many cases. Notably absent is any ability to monitor
directories automatically without wasting a lot of file descriptors.
Only get compiler lints/errors in strict mode. Also distinguish between
different kinds of shadowing for slightly different warnings and
lint-levels that better align with idiomatic code.
Prevent redefining bindings by accident. There are
a few cases where we want to allow this, such as the `default` macro, so
we allow a keyword :shadow to be included in the `def` expression to
turn off this lint.
TODO:
* Clean up test suite to remove binding shadowing
* Make sure that we don't get lints with *redef* turned on
* Add positive and negative tests for lint messages.
* Add location of shadowed binding in message