Be more complete with JANET_NO_SOURCEMAPS

This actually removed sourcemaps, not just
the top level annotation in bindings.
This commit is contained in:
Calvin Rose 2019-06-20 11:52:43 -04:00
parent cf05ff610f
commit 4b4fe80404
3 changed files with 9 additions and 3 deletions

View File

@ -63,7 +63,13 @@ int main(int argc, const char **argv) {
janet_def(env, "process/config", janet_wrap_table(opts), "Boot options");
/* Run bootstrap script to generate core image */
status = janet_dobytes(env, janet_gen_boot, janet_gen_boot_size, "boot.janet", NULL);
const char *boot_file;
#ifdef JANET_NO_SOURCEMAPS
boot_file = NULL;
#else
boot_file = "boot.janet";
#endif
status = janet_dobytes(env, janet_gen_boot, janet_gen_boot_size, boot_file, NULL);
/* Deinitialize vm */
janet_deinit();

View File

@ -629,7 +629,7 @@ JanetFuncDef *janetc_pop_funcdef(JanetCompiler *c) {
}
memcpy(def->bytecode, c->buffer + scope->bytecode_start, s);
janet_v__cnt(c->buffer) = scope->bytecode_start;
if (NULL != c->mapbuffer) {
if (NULL != c->mapbuffer && c->source) {
size_t s = sizeof(JanetSourceMapping) * def->bytecode_length;
def->sourcemap = malloc(s);
if (NULL == def->sourcemap) {

View File

@ -83,7 +83,7 @@
(def p (peg/compile grammar))
# Just make sure is valgrind clean.
(-> p make-image load-image)
(def p (-> p make-image load-image))
(assert (peg/match p "abc") "complex peg grammar 1")
(assert (peg/match p "[1 2 3 4]") "complex peg grammar 2")