mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-21 12:59:04 +00:00
compiler: track the result of string concatenation
Before this commit, the garbage collector was able to collect string values while they were still in use.
This commit is contained in:
@@ -41,6 +41,12 @@ func (b *builder) trackExpr(expr ssa.Value, value llvm.Value) {
|
|||||||
// pointer in there (if there is one).
|
// pointer in there (if there is one).
|
||||||
b.trackValue(value)
|
b.trackValue(value)
|
||||||
}
|
}
|
||||||
|
case *ssa.BinOp:
|
||||||
|
switch expr.Op {
|
||||||
|
case token.ADD:
|
||||||
|
// String concatenation.
|
||||||
|
b.trackValue(value)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user