Skip to content

Commit

Permalink
Do not retain unmanaged allocations in generated ctors (#762)
Browse files Browse the repository at this point in the history
  • Loading branch information
dcodeIO committed Aug 16, 2019
1 parent a7b9244 commit 37f27b1
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/compiler.ts
Expand Up @@ -7871,16 +7871,14 @@ export class Compiler extends DiagnosticEmitter {
// this.b = Y
// return this
// }
var allocExpr = this.makeAllocation(classInstance);
if (classInstance.type.isManaged) allocExpr = this.makeRetain(allocExpr);
stmts.push(
module.if(
module.unary(nativeSizeType == NativeType.I64 ? UnaryOp.EqzI64 : UnaryOp.EqzI32,
module.local_get(0, nativeSizeType)
),
module.local_set(0,
this.makeRetain(
this.makeAllocation(classInstance)
)
)
module.local_set(0, allocExpr)
)
);
if (baseClass) {
Expand Down

0 comments on commit 37f27b1

Please sign in to comment.