MCPcopy Create free account
hub / github.com/effect-app/libs / findClassBodyOpen

Function findClassBodyOpen

packages/eslint-codegen-model/src/cli.ts:128–198  ·  view source on GitHub ↗
(source: string, start: number)

Source from the content-addressed store, hash-verified

126}
127
128function findClassBodyOpen(source: string, start: number): number {
129 let parenDepth = 0
130 let bracketDepth = 0
131 let quote: "\"" | "'" | "`" | undefined
132 let escaped = false
133 let lineComment = false
134 let blockComment = false
135
136 for (let index = start; index < source.length; index++) {
137 const char = source[index]!
138 const next = source[index + 1]
139
140 if (lineComment) {
141 if (char === "\n") lineComment = false
142 continue
143 }
144 if (blockComment) {
145 if (char === "*" && next === "/") {
146 blockComment = false
147 index++
148 }
149 continue
150 }
151 if (quote) {
152 if (escaped) {
153 escaped = false
154 } else if (char === "\\") {
155 escaped = true
156 } else if (char === quote) {
157 quote = undefined
158 }
159 continue
160 }
161
162 if (char === "/" && next === "/") {
163 lineComment = true
164 index++
165 continue
166 }
167 if (char === "/" && next === "*") {
168 blockComment = true
169 index++
170 continue
171 }
172 if (char === "\"" || char === "'" || char === "`") {
173 quote = char
174 continue
175 }
176 if (char === "(") {
177 parenDepth++
178 continue
179 }
180 if (char === ")") {
181 parenDepth--
182 continue
183 }
184 if (char === "[") {
185 bracketDepth++

Callers 2

findClassEndFunction · 0.85
tryStructPrivateFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…