Skip to content

Commit b05b8c0

Browse files
authored
Add --debug flag to qsi for testing (microsoft#1531)
This adds a `--debug` flag to qsi that will make it load the interpreter with debug settings. That will make certain testing easier.
1 parent afacfd0 commit b05b8c0

File tree

2 files changed

+20
-2
lines changed

2 files changed

+20
-2
lines changed

compiler/qsc/README.md

+6
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,12 @@ Options:
4949
Disable automatic inclusion of the standard library
5050
--exec
5151
Exit after loading the files or running the given file(s)/entry on the command line
52+
-q, --qsharp-json <QSHARP_JSON>
53+
Path to a Q# manifest for a project
54+
-f, --features <FEATURES>
55+
Language features to compile with
56+
--debug
57+
Compile the given files and interactive snippets in debug mode
5258
-h, --help
5359
Print help
5460
-V, --version

compiler/qsc/src/bin/qsi.rs

+14-2
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,10 @@ struct Cli {
5252
/// Language features to compile with
5353
#[arg(short, long)]
5454
features: Vec<String>,
55+
56+
/// Compile the given files and interactive snippets in debug mode.
57+
#[arg(long)]
58+
debug: bool,
5559
}
5660

5761
struct TerminalReceiver;
@@ -102,7 +106,11 @@ fn main() -> miette::Result<ExitCode> {
102106
}
103107
}
104108
if cli.exec {
105-
let mut interpreter = match Interpreter::new(
109+
let mut interpreter = match (if cli.debug {
110+
Interpreter::new_with_debug
111+
} else {
112+
Interpreter::new
113+
})(
106114
!cli.nostdlib,
107115
SourceMap::new(sources, cli.entry.map(std::convert::Into::into)),
108116
PackageType::Exe,
@@ -122,7 +130,11 @@ fn main() -> miette::Result<ExitCode> {
122130
));
123131
}
124132

125-
let mut interpreter = match Interpreter::new(
133+
let mut interpreter = match (if cli.debug {
134+
Interpreter::new_with_debug
135+
} else {
136+
Interpreter::new
137+
})(
126138
!cli.nostdlib,
127139
SourceMap::new(sources, None),
128140
PackageType::Lib,

0 commit comments

Comments
 (0)