MCPcopy Create free account
hub / github.com/arktypeio/arktype / fieldKindIn

Method fieldKindIn

ark/aot/graph.ts:4148–4180  ·  view source on GitHub ↗
(
		cls: Node,
		name: unknown,
		module: SourceModule,
		kindOfKey: KindOfKey
	)

Source from the content-addressed store, hash-verified

4146 }
4147
4148 private fieldKindIn(
4149 cls: Node,
4150 name: unknown,
4151 module: SourceModule,
4152 kindOfKey: KindOfKey
4153 ): KindBits {
4154 const values = fieldValuesOf(cls)[name as string]
4155 let held = 0
4156 for (const value of values ?? []) {
4157 // e.g. `schema` in `constructor(readonly schema: Schema) {}`
4158 const param = module.scopes.bindingsById.get(value)
4159 held |=
4160 param ? kindOfKey(param, module)
4161 : (
4162 value.parent?.type === "MethodDefinition" &&
4163 value.parent.kind === "get"
4164 ) ?
4165 kindOfKey(value as FunctionNode, module)
4166 : this.transfer(value, module, kindOfKey)
4167 }
4168 // e.g. `repo.schema = User`, which may write an instance's field
4169 for (const value of memberWritesOf(module)[name as string] ?? [])
4170 held |= this.transfer(value, module, kindOfKey)
4171 const parent =
4172 "superClass" in cls &&
4173 cls.superClass &&
4174 this.classOf(cls.superClass, module, kindOfKey)
4175 if (parent && this.mayDeclare(parent, name))
4176 held |= kindOfKey(this.memberOf(parent.node, name), parent.module)
4177 // e.g. a field a decorator or a subclass the build can't read sets
4178 else if (!values) held |= opaque
4179 return lostOf(held)
4180 }
4181
4182 private mayDeclare(
4183 cls: Located,

Callers 1

keyKindOfMethod · 0.95

Calls 8

transferMethod · 0.95
classOfMethod · 0.95
mayDeclareMethod · 0.95
memberOfMethod · 0.95
fieldValuesOfFunction · 0.85
memberWritesOfFunction · 0.85
lostOfFunction · 0.85
getMethod · 0.65

Tested by

no test coverage detected