Skip to content

Commit

Permalink
compiler: fix debug information collection and using for function calls
Browse files Browse the repository at this point in the history
  • Loading branch information
mertcandav committed Mar 7, 2024
1 parent 7645abe commit c8bdcad
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 25 deletions.
47 changes: 26 additions & 21 deletions src/julec/obj/cxx/expr.jule
Original file line number Diff line number Diff line change
Expand Up @@ -478,6 +478,31 @@ impl ExprCoder {
}
}

fn push_call_inf(mut self, mut &obj: str, &m: &FnCallExprModel) {
if env::PRODUCTION || (!m.func.anon && !is_builtin_call_has_debuginf(m)) {
obj += "("
ret
}
if m.func.anon {
match type m.expr {
| &StructSubIdentExprModel:
if (&StructSubIdentExprModel)(m.expr).field.decl.owner.cpp_linked {
obj += "("
ret
}
fall
|:
obj += ".call"
}
}
obj += "(\""
obj += self.oc.loc_info(m.token)
obj += "\""
if m.args.len != 0 {
obj += ","
}
}

fn pure_func_call(mut self, mut &m: &FnCallExprModel): str {
let mut obj = self.model_for_call(m.expr)
if !m.func.is_builtin() {
Expand All @@ -493,27 +518,7 @@ impl ExprCoder {
}
}
}
if !env::PRODUCTION && (m.func.anon || is_builtin_call_has_debuginf(m)) {
if m.func.anon {
match type m.expr {
| &StructSubIdentExprModel:
if (&StructSubIdentExprModel)(m.expr).field.decl.owner.cpp_linked {
break
}
fall
|:
obj += ".call"
}
}
obj += "(\""
obj += self.oc.loc_info(m.token)
obj += "\""
if m.args.len != 0 {
obj += ","
}
} else {
obj += "("
}
self.push_call_inf(obj, m)
obj += self.args(m.args)
obj += ")"

Expand Down
3 changes: 1 addition & 2 deletions src/julec/obj/cxx/object.jule
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ impl ObjectCoder {

// Returns location information of token as cstr bytes.
fn loc_info(self, &t: Token): str {
let mut loc = if t.file == nil { "/jule/builtin" } else { t.file.path() }
let mut loc = t.file.path()

// Normalize path if production compilation enabled.
if env::PRODUCTION {
Expand All @@ -100,7 +100,6 @@ impl ObjectCoder {
loc = loc[path::dir(self.ir.root).len + 1:]
}
}

loc += ":"
loc += conv::itoa(t.row)
loc += ":"
Expand Down
1 change: 1 addition & 0 deletions std/jule/sema/builtin.jule
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,7 @@ fn builtin_caller_common_plain(mut &e: &Eval, mut &fc: &FnCallExpr, mut &d: &Dat
func: f,
expr: d.model,
args: fcac.arg_models,
token: fc.token,
}

if f.result == nil {
Expand Down
2 changes: 0 additions & 2 deletions std/jule/sema/eval.jule
Original file line number Diff line number Diff line change
Expand Up @@ -2006,7 +2006,6 @@ impl Eval {
if d == nil {
ret
}

d.mutable = true
}

Expand Down Expand Up @@ -2040,7 +2039,6 @@ impl Eval {
ch = &Scope{}
csc.table.vars = append(csc.table.vars, build_error_var(ch, fc))
csc.check(fc.exception, ch)

| &ScopeChecker:
let mut sc = (&ScopeChecker)(self.lookup)
csc = sc.new_child_checker()
Expand Down

0 comments on commit c8bdcad

Please sign in to comment.