Skip to content

Commit 29488bb

Browse files
committed
Support the --no-loc flag
1 parent 9c5fa86 commit 29488bb

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/bin/lpython.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -225,9 +225,9 @@ int emit_asr(const std::string &infile,
225225
std::cout << LCompilers::pickle_tree(*asr,
226226
compiler_options.use_colors, with_intrinsic_modules) << std::endl;
227227
} else if (compiler_options.po.json) {
228-
std::cout << LCompilers::pickle_json(*asr, lm, with_intrinsic_modules) << std::endl;
228+
std::cout << LCompilers::pickle_json(*asr, lm, compiler_options.po.no_loc, with_intrinsic_modules) << std::endl;
229229
} else if (compiler_options.po.visualize) {
230-
std::string astr_data_json = LCompilers::pickle_json(*asr, lm, with_intrinsic_modules);
230+
std::string astr_data_json = LCompilers::pickle_json(*asr, lm, compiler_options.po.no_loc, with_intrinsic_modules);
231231
return visualize_json(astr_data_json, compiler_options.platform);
232232
} else {
233233
std::cout << LCompilers::pickle(*asr, compiler_options.use_colors,
@@ -1571,6 +1571,7 @@ int main(int argc, char *argv[])
15711571
app.add_flag("--no-indent", arg_no_indent, "Turn off Indented print ASR/AST");
15721572
app.add_flag("--tree", compiler_options.po.tree, "Tree structure print ASR/AST");
15731573
app.add_flag("--json", compiler_options.po.json, "Print ASR/AST Json format");
1574+
app.add_flag("--no-loc", compiler_options.po.no_loc, "Skip location information in ASR/AST Json format");
15741575
app.add_flag("--visualize", compiler_options.po.visualize, "Print ASR/AST Visualization");
15751576
app.add_option("--pass", arg_pass, "Apply the ASR pass and show ASR (implies --show-asr)");
15761577
app.add_option("--skip-pass", skip_pass, "Skip an ASR pass in default pipeline");

0 commit comments

Comments
 (0)