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.
Этот коммит содержится в:
Jaden Weiss 2020-04-01 18:57:58 -04:00 коммит произвёл Ayke
родитель 6e86daa95e
коммит 6647c43a7b

Просмотреть файл

@ -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)
}
}
}