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

Function replaceContext

packages/effect/src/SchemaAST.ts:3354–3367  ·  view source on GitHub ↗
(ast: A, context: Context | undefined)

Source from the content-addressed store, hash-verified

3352
3353/** @internal */
3354export function replaceContext<A extends AST>(ast: A, context: Context | undefined): A {
3355 if (ast.context === context) {
3356 return ast
3357 }
3358 const owner = getContextOwner(ast)
3359 if (owner.context === context) {
3360 return owner as A
3361 }
3362 const out = modifyOwnPropertyDescriptors(ast, (d) => {
3363 d.context.value = context
3364 })
3365 contextOwners.set(out, owner)
3366 return out
3367}
3368
3369/** @internal */
3370export function getLastEncoding(ast: AST): AST {

Callers 4

replaceContextLastLinkFunction · 0.85
annotateKeyFunction · 0.85
SchemaAST.tsFile · 0.85
withConstructorDefaultFunction · 0.85

Calls 3

getContextOwnerFunction · 0.85
setMethod · 0.65

Tested by

no test coverage detected