MCPcopy Create free account
hub / github.com/Effect-TS/effect / pickInternalCall

Function pickInternalCall

packages/effect/src/Utils.ts:203–225  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

201// statements) so the whole selection is pure-annotated by the build and
202// tree-shakable when `internalCall` is unused.
203const 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 */
228export const internalCall = pickInternalCall()

Callers 1

Utils.tsFile · 0.85

Calls 1

bodyFunction · 0.50

Tested by

no test coverage detected