Skip to content

Commit

Permalink
compiler: track the result of string concatenation
Browse files Browse the repository at this point in the history
Before this commit, the garbage collector was able to collect string values while they were still in use.
  • Loading branch information
niaow authored and aykevl committed Apr 2, 2020
1 parent 6e86daa commit 6647c43
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions compiler/gc.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,12 @@ func (b *builder) trackExpr(expr ssa.Value, value llvm.Value) {
// pointer in there (if there is one).
b.trackValue(value)
}
case *ssa.BinOp:
switch expr.Op {
case token.ADD:
// String concatenation.
b.trackValue(value)
}
}
}

Expand Down

0 comments on commit 6647c43

Please sign in to comment.