(file *SourceFile, key *SourceFileDataKey[T], compute func(*SourceFile) T)
| 2420 | } |
| 2421 | |
| 2422 | func GetOrComputeSourceFileData[T any](file *SourceFile, key *SourceFileDataKey[T], compute func(*SourceFile) T) T { |
| 2423 | cell := getSourceFileDataCell(file, key) |
| 2424 | cell.once.Do(func() { |
| 2425 | cell.value = compute(file) |
| 2426 | }) |
| 2427 | return cell.value |
| 2428 | } |
| 2429 | |
| 2430 | func getSourceFileDataCell[T any](file *SourceFile, key *SourceFileDataKey[T]) *sourceFileDataCell[T] { |
| 2431 | if key == nil || key.key == 0 { |
no test coverage detected