( stmtMap: Map<string, Statement>, typedStmts: Statement[], firstId: string, rootName?: string, )
| 162 | } |
| 163 | |
| 164 | function pickEntryId( |
| 165 | stmtMap: Map<string, Statement>, |
| 166 | typedStmts: Statement[], |
| 167 | firstId: string, |
| 168 | rootName?: string, |
| 169 | ): string { |
| 170 | if (stmtMap.has(DEFAULT_ROOT_STATEMENT_ID)) return DEFAULT_ROOT_STATEMENT_ID; |
| 171 | if (rootName && stmtMap.has(rootName)) return rootName; |
| 172 | |
| 173 | const preferredComponent = rootName |
| 174 | ? typedStmts.find((stmt) => isComponentStatement(stmt) && stmt.expr.name === rootName) |
| 175 | : undefined; |
| 176 | if (preferredComponent) return preferredComponent.id; |
| 177 | |
| 178 | const firstComponent = typedStmts.find(isComponentStatement); |
| 179 | return firstComponent?.id ?? firstId; |
| 180 | } |
| 181 | |
| 182 | function buildResult( |
| 183 | stmtMap: Map<string, Statement>, |
no test coverage detected