Commit 34014196 authored by Kevin Modzelewski's avatar Kevin Modzelewski

Decref overwritten closure values

parent 68f3777f
......@@ -1906,6 +1906,10 @@ private:
CompilerVariable* closure = symbol_table[internString(CREATED_CLOSURE_NAME)];
llvm::Value* closureValue = closure->makeConverted(emitter, CLOSURE)->getValue();
llvm::Value* gep = getClosureElementGep(emitter, closureValue, offset);
if (prev) {
auto load = emitter.getBuilder()->CreateLoad(gep);
emitter.setType(load, RefType::OWNED);
}
llvm::Value* v = val->makeConverted(emitter, UNKNOWN)->getValue();
auto store = emitter.getBuilder()->CreateStore(v, gep);
emitter.refConsumed(v, store);
......
# expected: reffail
# closure tests
# simple closure:
......
# expected: fail
# Dict comparisons are supposed to be based on contents:
l1 = []
l2 = []
for i in xrange(100):
l1.append({1:1})
l2.append({2:2})
t = [0,0]
for a in l1:
for b in l2:
t[a < b] += 1
print t # should be [0, 10000]
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment