Skip to content

Commit dbeebd9

Browse files
committed
fix: unix debug & "use" statement panic
1 parent 0576a62 commit dbeebd9

File tree

4 files changed

+13
-7
lines changed

4 files changed

+13
-7
lines changed

src/ast/ctx.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -377,11 +377,13 @@ pub fn create_ctx_info<'ctx>(
377377
let metav = context.metadata_node(&[BasicMetadataValueEnum::IntValue(
378378
context.i32_type().const_int(3, false),
379379
)]);
380-
let metacv = context.metadata_node(&[BasicMetadataValueEnum::IntValue(
381-
context.i32_type().const_int(1, false),
382-
)]);
383380
module.add_metadata_flag("Debug Info Version", FlagBehavior::Warning, metav);
384-
module.add_metadata_flag("CodeView", FlagBehavior::Warning, metacv); // TODO: is this needed for windows debug?
381+
if cfg!(target_os = "windows") {
382+
let metacv = context.metadata_node(&[BasicMetadataValueEnum::IntValue(
383+
context.i32_type().const_int(1, false),
384+
)]);
385+
module.add_metadata_flag("CodeView", FlagBehavior::Warning, metacv); // TODO: is this needed for windows debug?
386+
}
385387
let tm = get_target_machine(inkwell::OptimizationLevel::None);
386388
(
387389
module,

src/nomparser/pkg.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use nom::{
22
combinator::{map_res, opt},
3-
multi::separated_list0,
3+
multi::separated_list1,
44
sequence::{preceded, tuple},
55
IResult,
66
};
@@ -23,7 +23,7 @@ pub fn use_statement(input: Span) -> IResult<Span, Box<NodeEnum>> {
2323
preceded(
2424
tag_token(TokenType::USE),
2525
delspace(tuple((
26-
separated_list0(tag_token(TokenType::DOUBLE_COLON), identifier),
26+
separated_list1(tag_token(TokenType::DOUBLE_COLON), identifier),
2727
opt(tag_token(TokenType::DOUBLE_COLON)),
2828
opt(tag_token(TokenType::COLON)),
2929
))),

test/lsp/test_completion.pi

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,6 @@ struct test1 {
1515
a:bool;
1616
b:f64;
1717
c:i64;
18-
}
18+
}
19+
20+
use

test/main.pi

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ use project2::main;
55
use project2::main::test;
66
use core::panic;
77
use std::io;
8+
use core::panic;
89
const a = 100;
910
struct struct_father {
1011
a: i64;
@@ -86,6 +87,7 @@ fn test_if_ret_only(judge: bool) void {
8687
if judge {
8788
return;
8889
} else {
90+
panic::pl_panic();
8991
//156411
9092
}
9193
return;

0 commit comments

Comments
 (0)