MCPcopy Index your code
hub / github.com/TypeScriptToLua/TypeScriptToLua / getLuaLibExportToFeatureMap

Function getLuaLibExportToFeatureMap

src/LuaLib.ts:158–174  ·  view source on GitHub ↗
(
    luaTarget: LuaTarget,
    emitHost: EmitHost
)

Source from the content-addressed store, hash-verified

156const lualibExportToFeature = new Map<LuaTarget, ReadonlyMap<string, LuaLibFeature>>();
157
158export function getLuaLibExportToFeatureMap(
159 luaTarget: LuaTarget,
160 emitHost: EmitHost
161): ReadonlyMap<string, LuaLibFeature> {
162 if (!lualibExportToFeature.has(luaTarget)) {
163 const luaLibModulesInfo = getLuaLibModulesInfo(luaTarget, emitHost);
164 const map = new Map<string, LuaLibFeature>();
165 for (const [feature, info] of Object.entries(luaLibModulesInfo)) {
166 for (const exportName of info.exports) {
167 map.set(exportName, feature as LuaLibFeature);
168 }
169 }
170 lualibExportToFeature.set(luaTarget, map);
171 }
172
173 return lualibExportToFeature.get(luaTarget)!;
174}
175
176const lualibFeatureCache = new Map<LuaTarget, Map<LuaLibFeature, string>>();
177

Callers 1

findUsedLualibFeaturesFunction · 0.85

Calls 5

setMethod · 0.95
getLuaLibModulesInfoFunction · 0.85
entriesMethod · 0.65
hasMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected