aboutsummaryrefslogtreecommitdiff
path: root/src/tomo.c
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2025-04-15 10:41:06 -0400
committerBruce Hill <bruce@bruce-hill.com>2025-04-15 10:41:06 -0400
commit4a604a298c0cde9667c483e93106a209b4cd3055 (patch)
treee25b28b177bc01315173443ac15f4ae9850c84c2 /src/tomo.c
parentc1ae3ad9f42d510650f972671fcb0df0c3aa8388 (diff)
Add --no-source-mapping flag
Diffstat (limited to 'src/tomo.c')
-rw-r--r--src/tomo.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/tomo.c b/src/tomo.c
index 61f2ed3d..865af840 100644
--- a/src/tomo.c
+++ b/src/tomo.c
@@ -55,7 +55,8 @@ static OptionalBool_t verbose = false,
compile_exe = false,
should_install = false,
run_repl = false,
- clean_build = false;
+ clean_build = false,
+ source_mapping = true;
static OptionalText_t
show_codegen = NONE_TEXT,
@@ -178,6 +179,8 @@ int main(int argc, char *argv[])
{"O", false, &Text$info, &optimization},
{"force-rebuild", false, &Bool$info, &clean_build},
{"f", false, &Bool$info, &clean_build},
+ {"source-mapping", false, &Bool$info, &source_mapping},
+ {"m", false, &Bool$info, &source_mapping},
);
bool is_gcc = (system(String(cc, " -v 2>&1 | grep 'gcc version' >/dev/null")) == 0);
@@ -254,7 +257,7 @@ int main(int argc, char *argv[])
pid_t child = fork();
if (child == 0) {
- env_t *env = global_env();
+ env_t *env = global_env(source_mapping);
List_t object_files = {},
extra_ldlibs = {};
compile_files(env, files, &object_files, &extra_ldlibs);
@@ -411,7 +414,7 @@ static void _compile_file_header_for_library(env_t *env, Path_t header_path, Pat
void build_library(Text_t lib_dir_name)
{
List_t tm_files = Path$glob(Path("./[!._0-9]*.tm"));
- env_t *env = fresh_scope(global_env());
+ env_t *env = fresh_scope(global_env(source_mapping));
List_t object_files = {},
extra_ldlibs = {};
@@ -718,8 +721,8 @@ void transpile_code(env_t *base_env, Path_t path)
", but it should not have any return value!");
CORD_put(CORD_all(
- "int ", main_binding->code, "$parse_and_run(int argc, char *argv[]) {\n"
- "#line 1\n"
+ "int ", main_binding->code, "$parse_and_run(int argc, char *argv[]) {\n",
+ module_env->do_source_mapping ? "#line 1\n" : CORD_EMPTY,
"tomo_init();\n",
"_$", module_env->namespace->name, "$$initialize();\n"
"\n",