* Perform action under a new scope. * * @param action The action function. * @returns The result value. * * Note: For action to return a valid value, * we will need to call moveToParentScope * for the objects that are created in the scope.
(action: () => T)
| 1009 | * for the objects that are created in the scope. |
| 1010 | */ |
| 1011 | withNewScope<T>(action: () => T): T { |
| 1012 | this.beginScope(); |
| 1013 | const val = action(); |
| 1014 | this.endScope(); |
| 1015 | return val; |
| 1016 | } |
| 1017 | |
| 1018 | /** |
| 1019 | * Attach a detached obj to the auto-release pool of the current scope. |
no test coverage detected