| 201 | // statements) so the whole selection is pure-annotated by the build and |
| 202 | // tree-shakable when `internalCall` is unused. |
| 203 | const pickInternalCall = (): <A>(body: () => A) => A => { |
| 204 | const InternalTypeId = "~effect/Utils/internal" |
| 205 | |
| 206 | const standard = { |
| 207 | [InternalTypeId]: <A>(body: () => A) => { |
| 208 | return body() |
| 209 | } |
| 210 | } |
| 211 | |
| 212 | const forced = { |
| 213 | [InternalTypeId]: <A>(body: () => A) => { |
| 214 | try { |
| 215 | return body() |
| 216 | } finally { |
| 217 | // |
| 218 | } |
| 219 | } |
| 220 | } |
| 221 | |
| 222 | const isNotOptimizedAway = standard[InternalTypeId](() => new Error().stack)?.includes(InternalTypeId) === true |
| 223 | |
| 224 | return isNotOptimizedAway ? standard[InternalTypeId] : forced[InternalTypeId] |
| 225 | } |
| 226 | |
| 227 | /** @internal */ |
| 228 | export const internalCall = pickInternalCall() |