Skip to content

Commit

Permalink
sema: update reference variable handling
Browse files Browse the repository at this point in the history
  • Loading branch information
mertcandav committed Aug 21, 2024
1 parent 867929f commit 05b27a2
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion std/jule/sema/scope.jule
Original file line number Diff line number Diff line change
Expand Up @@ -1428,7 +1428,11 @@ impl scopeChecker {
// Set value to nil.
// Because this variable should be uninitialized declaration.
// Otherwise, code generation needs more analysis.
v.Value = nil
// For references, leave values. References always should be initialized.
// So, some optimizations and utilities may use this rule.
if !v.Reference {
v.Value = nil
}

st.L = append(st.L, &Data{
Lvalue: !v.Constant,
Expand Down

0 comments on commit 05b27a2

Please sign in to comment.