mirror of
https://github.com/fluencelabs/assemblyscript
synced 2025-06-23 11:41:45 +00:00
Implement reference counting (#592)
This commit is contained in:
26
tests/compiler/rc/local-init.ts
Normal file
26
tests/compiler/rc/local-init.ts
Normal file
@ -0,0 +1,26 @@
|
||||
{
|
||||
// Normal assignment will retain and release.
|
||||
|
||||
let a = /* __retain( */ "" /* ) */;
|
||||
// __release(a)
|
||||
}
|
||||
|
||||
function getRef(): string {
|
||||
return /* __retain( */ "" /* ) */;
|
||||
}
|
||||
|
||||
{
|
||||
// Assignment of a return value picks up its skipped autorelease
|
||||
|
||||
let b = getRef();
|
||||
// __release(b);
|
||||
}
|
||||
|
||||
class Ref {}
|
||||
|
||||
{
|
||||
// Assignment of an instantiation picks up its skipped autorelease
|
||||
|
||||
let c = new Ref();
|
||||
// __release(c);
|
||||
}
|
Reference in New Issue
Block a user