Skip to content

Commit

Permalink
Do not retain unmanaged allocations in generated ctors (AssemblyScrip…
Browse files Browse the repository at this point in the history
  • Loading branch information
dcodeIO authored and willemneal committed Aug 23, 2019
1 parent 92cc5a2 commit 9b1b97d
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 9b1b97d

Please sign in to comment.