@@ -348,42 +348,41 @@ releasenone
348
348
visible release has happened (i.e it is allowed for a ``releasenone ``
349
349
function to allocate and destruct an object in its implementation as long as
350
350
this is does not cause an release of an object visible outside of the
351
- implementation).
351
+ implementation). Here are some examples::
352
352
353
- Examples
354
- ::
355
- class SomeObject {
356
- final var x: Int = 3
357
- }
358
- var global = SomeObject()
353
+ class SomeObject {
354
+ final var x: Int = 3
355
+ }
356
+
357
+ var global = SomeObject()
359
358
360
- class SomeOtherObject {
361
- var x: Int = 2
362
- deinit {
363
- global = SomeObject()
359
+ class SomeOtherObject {
360
+ var x: Int = 2
361
+ deinit {
362
+ global = SomeObject()
363
+ }
364
364
}
365
- }
366
365
367
- @effects(releasenone)
368
- func validReleaseNoneFunction(x: Int) -> Int {
369
- global.x = 5
370
- return x + 2
371
- }
366
+ @effects(releasenone)
367
+ func validReleaseNoneFunction(x: Int) -> Int {
368
+ global.x = 5
369
+ return x + 2
370
+ }
372
371
373
- @effects(releasenone)
374
- func validReleaseNoneFunction(x: Int) -> Int {
375
- var notExternallyVisibleObject = SomeObject()
376
- return x + notExternallyVisibleObject.x
377
- }
372
+ @effects(releasenone)
373
+ func validReleaseNoneFunction(x: Int) -> Int {
374
+ var notExternallyVisibleObject = SomeObject()
375
+ return x + notExternallyVisibleObject.x
376
+ }
378
377
379
- func notAReleaseNoneFunction(x: Int, y: SomeObject) -> Int {
380
- return x + y.x
381
- }
378
+ func notAReleaseNoneFunction(x: Int, y: SomeObject) -> Int {
379
+ return x + y.x
380
+ }
382
381
383
- func notAReleaseNoneFunction(x: Int) -> Int {
384
- var releaseExternallyVisible = SomeOtherObject()
385
- return x + releaseExternallyVisible.x
386
- }
382
+ func notAReleaseNoneFunction(x: Int) -> Int {
383
+ var releaseExternallyVisible = SomeOtherObject()
384
+ return x + releaseExternallyVisible.x
385
+ }
387
386
388
387
readwrite
389
388
0 commit comments