|
| 1 | +/** |
| 2 | + * Copyright (c) Meta Platforms, Inc. and affiliates. |
| 3 | + * |
| 4 | + * This source code is licensed under the MIT license found in the |
| 5 | + * LICENSE file in the root directory of this source tree. |
| 6 | + * |
| 7 | + * @flow strict-local |
| 8 | + * @format |
| 9 | + */ |
| 10 | + |
| 11 | +import type {LLVMFileData, LLVMFunctionData} from '../convertLLVMCoverage'; |
| 12 | + |
| 13 | +export type LLVMCoverage = { |
| 14 | + file: LLVMFileData, |
| 15 | + functions: Array<LLVMFunctionData>, |
| 16 | + lcov: string[], |
| 17 | +}; |
| 18 | + |
| 19 | +export default function loadLLVMCoverage( |
| 20 | + name: |
| 21 | + | 'AppSettings.cpp' |
| 22 | + | 'Class.h' |
| 23 | + | 'DevSettingsModule.h' |
| 24 | + | 'NativeFantom.h' |
| 25 | + | 'NativeFantom.cpp' |
| 26 | + | 'RawPropsKey.cpp', |
| 27 | +): LLVMCoverage { |
| 28 | + match (name) { |
| 29 | + 'AppSettings.cpp' => { |
| 30 | + return { |
| 31 | + // $FlowExpectedError[untyped-import] |
| 32 | + file: require('./resources/AppSettings.cpp.json') as LLVMFileData, |
| 33 | + functions: |
| 34 | + // $FlowExpectedError[untyped-import] |
| 35 | + require('./resources/AppSettings.cpp.functions.json') as Array<LLVMFunctionData>, |
| 36 | + // $FlowExpectedError[untyped-import] |
| 37 | + lcov: require('./resources/AppSettings.cpp.lcov.json') as string[], |
| 38 | + }; |
| 39 | + } |
| 40 | + 'Class.h' => { |
| 41 | + return { |
| 42 | + // $FlowExpectedError[untyped-import] |
| 43 | + file: require('./resources/Class.h.json') as LLVMFileData, |
| 44 | + functions: |
| 45 | + // $FlowExpectedError[untyped-import] |
| 46 | + require('./resources/Class.h.functions.json') as Array<LLVMFunctionData>, |
| 47 | + // $FlowExpectedError[untyped-import] |
| 48 | + lcov: require('./resources/Class.h.lcov.json') as string[], |
| 49 | + }; |
| 50 | + } |
| 51 | + 'DevSettingsModule.h' => { |
| 52 | + return { |
| 53 | + // $FlowExpectedError[untyped-import] |
| 54 | + file: require('./resources/DevSettingsModule.h.json') as LLVMFileData, |
| 55 | + functions: |
| 56 | + // $FlowExpectedError[untyped-import] |
| 57 | + require('./resources/DevSettingsModule.h.functions.json') as Array<LLVMFunctionData>, |
| 58 | + // $FlowExpectedError[untyped-import] |
| 59 | + lcov: require('./resources/DevSettingsModule.h.lcov.json') as string[], |
| 60 | + }; |
| 61 | + } |
| 62 | + 'NativeFantom.cpp' => { |
| 63 | + return { |
| 64 | + // $FlowExpectedError[untyped-import] |
| 65 | + file: require('./resources/NativeFantom.cpp.json') as LLVMFileData, |
| 66 | + functions: |
| 67 | + // $FlowExpectedError[untyped-import] |
| 68 | + require('./resources/NativeFantom.cpp.functions.json') as Array<LLVMFunctionData>, |
| 69 | + // $FlowExpectedError[untyped-import] |
| 70 | + lcov: require('./resources/NativeFantom.cpp.lcov.json') as string[], |
| 71 | + }; |
| 72 | + } |
| 73 | + 'NativeFantom.h' => { |
| 74 | + return { |
| 75 | + // $FlowExpectedError[untyped-import] |
| 76 | + file: require('./resources/NativeFantom.h.json') as LLVMFileData, |
| 77 | + functions: |
| 78 | + // $FlowExpectedError[untyped-import] |
| 79 | + require('./resources/NativeFantom.h.functions.json') as Array<LLVMFunctionData>, |
| 80 | + // $FlowExpectedError[untyped-import] |
| 81 | + lcov: require('./resources/NativeFantom.h.lcov.json') as string[], |
| 82 | + }; |
| 83 | + } |
| 84 | + 'RawPropsKey.cpp' => { |
| 85 | + return { |
| 86 | + // $FlowExpectedError[untyped-import] |
| 87 | + file: require('./resources/RawPropsKey.cpp.json') as LLVMFileData, |
| 88 | + functions: |
| 89 | + // $FlowExpectedError[untyped-import] |
| 90 | + require('./resources/RawPropsKey.cpp.functions.json') as Array<LLVMFunctionData>, |
| 91 | + // $FlowExpectedError[untyped-import] |
| 92 | + lcov: require('./resources/RawPropsKey.cpp.lcov.json') as string[], |
| 93 | + }; |
| 94 | + } |
| 95 | + } |
| 96 | +} |
0 commit comments