(view: any, sourceRoot = "")
| 2251 | } |
| 2252 | |
| 2253 | function sourceLocationForView(view: any, sourceRoot = ""): JSONObject | null { |
| 2254 | const raw = safeCall( |
| 2255 | () => view.getAttribute?.(angularSourceLocationAttribute), |
| 2256 | null, |
| 2257 | ); |
| 2258 | const value = stringValue(raw); |
| 2259 | if (!value) { |
| 2260 | return null; |
| 2261 | } |
| 2262 | const separator = value.lastIndexOf("@"); |
| 2263 | if (separator <= 0) { |
| 2264 | return { file: absoluteSourceFile(value, sourceRoot) }; |
| 2265 | } |
| 2266 | const location: JSONObject = { |
| 2267 | file: absoluteSourceFile(value.slice(0, separator), sourceRoot), |
| 2268 | }; |
| 2269 | for (const part of value.slice(separator + 1).split(",")) { |
| 2270 | const [key, rawNumber] = part.split(":"); |
| 2271 | const parsed = Number(rawNumber); |
| 2272 | if (!Number.isFinite(parsed)) { |
| 2273 | continue; |
| 2274 | } |
| 2275 | if (key === "o") { |
| 2276 | location.offset = parsed; |
| 2277 | } else if (key === "l") { |
| 2278 | location.line = parsed; |
| 2279 | } else if (key === "c") { |
| 2280 | location.column = parsed; |
| 2281 | } |
| 2282 | } |
| 2283 | return location; |
| 2284 | } |
| 2285 | |
| 2286 | function nativeScriptInfo( |
| 2287 | view: View, |
no test coverage detected