MCPcopy Create free account
hub / github.com/AlexErrant/Pentive / attachQuery

Function attachQuery

shared-dom/src/language/query2sql.ts:271–289  ·  view source on GitHub ↗
(
	node: SyntaxNodeRef,
	label: Label | undefined,
	context: Context,
	queryOrField: QueryString | QueryRegex,
)

Source from the content-addressed store, hash-verified

269// we cache the field because the next run of astEnter should be on the field's value, and we need the field
270let fieldCache: QueryString | QueryRegex | undefined
271function attachQuery(
272 node: SyntaxNodeRef,
273 label: Label | undefined,
274 context: Context,
275 queryOrField: QueryString | QueryRegex,
276) {
277 if (label === field) {
278 if (node.node.parent?.type.is(qt.FieldName) === true) {
279 fieldCache = queryOrField
280 } else {
281 console.assert(fieldCache, 'query.Field should have a value!')
282 queryOrField.field = fieldCache
283 context.current.attach(queryOrField)
284 fieldCache = undefined
285 }
286 } else {
287 context.current.attach(queryOrField)
288 }
289}
290
291function astEnter(input: string, node: SyntaxNodeRef, context: Context) {
292 if (node.type.isError) return

Callers 1

astEnterFunction · 0.85

Calls 1

attachMethod · 0.80

Tested by

no test coverage detected