Skip to content

Commit

Permalink
fix: missing global init when compile args is not entry file
Browse files Browse the repository at this point in the history
  • Loading branch information
Chronostasys committed Oct 18, 2023
1 parent f65d521 commit 8c2ef5f
Showing 1 changed file with 27 additions and 25 deletions.
52 changes: 27 additions & 25 deletions src/ast/node/function.rs
Original file line number Diff line number Diff line change
Expand Up @@ -688,31 +688,33 @@ impl FuncDefNode {
}
// emit body
builder.rm_curr_debug_location();
if self.id.name == "main" && ctx.is_active_file() {
PLCodeLens::push(
ctx.db,
CodeLens {
range: self.id.range.to_diag_range(),
command: Some(Command::new(
"run".to_owned(),
"pivot-lang.run_current".to_owned(),
None,
)),
data: None,
},
);
PLCodeLens::push(
ctx.db,
CodeLens {
range: self.id.range.to_diag_range(),
command: Some(Command::new(
"debug".to_owned(),
"pivot-lang.debug_current".to_owned(),
None,
)),
data: None,
},
);
if self.id.name == "main" {
if ctx.is_active_file() {
PLCodeLens::push(
ctx.db,
CodeLens {
range: self.id.range.to_diag_range(),
command: Some(Command::new(
"run".to_owned(),
"pivot-lang.run_current".to_owned(),
None,
)),
data: None,
},
);
PLCodeLens::push(
ctx.db,
CodeLens {
range: self.id.range.to_diag_range(),
command: Some(Command::new(
"debug".to_owned(),
"pivot-lang.debug_current".to_owned(),
None,
)),
data: None,
},
);
}
if let Some(inst) = builder.get_first_instruction(entry) {
builder.position_at(inst);
} else {
Expand Down

0 comments on commit 8c2ef5f

Please sign in to comment.