diff options
author | Jaden Weiss <[email protected]> | 2020-04-01 18:57:58 -0400 |
---|---|---|
committer | Ayke <[email protected]> | 2020-04-02 14:04:25 +0200 |
commit | 6647c43a7b82957401b112ebb4f53ac9dda0f8fa (patch) | |
tree | 9e1c6c08665111c7b52981246d52dde211662be8 | |
parent | 6e86daa95e2b0279d31c142b88c0e99e95cff6c0 (diff) | |
download | tinygo-6647c43a7b82957401b112ebb4f53ac9dda0f8fa.tar.gz tinygo-6647c43a7b82957401b112ebb4f53ac9dda0f8fa.zip |
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.
-rw-r--r-- | compiler/gc.go | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/compiler/gc.go b/compiler/gc.go index ceb071bf7..6aa0b45a9 100644 --- a/compiler/gc.go +++ b/compiler/gc.go @@ -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) + } } } |