MCPcopy Create free account
hub / github.com/thetarnav/solid-devtools / VariableDeclaration

Function VariableDeclaration

packages/main/src/babel/babel.ts:163–189  ·  view source on GitHub ↗
(path)

Source from the content-addressed store, hash-verified

161 },
162
163 VariableDeclaration(path) {
164 if (!FileWithImports) return
165
166 for (const decl of path.node.declarations) {
167
168 // Check initializer is a call to createSignal/createMemo/createStore/createMutable
169 if (!decl.init || decl.init.type !== 'CallExpression') continue
170
171 const target = getTarget(decl.init.callee, Sources, SOURCE_TYPES.returning)
172 if (!target) continue
173
174 let name: string
175
176 // Check declaration is either identifier or [identifier, ...]
177 if (decl.id.type === 'Identifier') {
178 name = decl.id.name
179 }
180 else if (decl.id.type === 'ArrayPattern' && decl.id.elements[0]?.type === 'Identifier') {
181 name = decl.id.elements[0].name
182 }
183 else {
184 continue
185 }
186
187 addNameToOptions(decl.init, OPTIONS_ARG_POS[target], name)
188 }
189 },
190
191 CallExpression(path) {
192 if (!FileWithImports) return

Callers

nothing calls this directly

Calls 2

getTargetFunction · 0.85
addNameToOptionsFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…