MCPcopy
hub / github.com/webpack/webpack / addUsage

Function addUsage

lib/optimize/InnerGraph.js:224–238  ·  view source on GitHub ↗

* @param {ParserState} state parser state * @param {TopLevelSymbol | null} symbol the symbol, or null for all symbols * @param {Usage} usage usage data * @returns {void}

(state, symbol, usage)

Source from the content-addressed store, hash-verified

222 * @returns {void}
223 */
224 function addUsage(state, symbol, usage) {
225 const innerGraphState = getState(state);
226
227 if (innerGraphState) {
228 const { innerGraph } = innerGraphState;
229 const info = innerGraph.get(symbol);
230 if (usage === true) {
231 innerGraph.set(symbol, true);
232 } else if (info === undefined) {
233 innerGraph.set(symbol, new Set([usage]));
234 } else if (info !== true) {
235 info.add(usage);
236 }
237 }
238 }
239
240 /**
241 * @param {JavascriptParser} parser the parser

Callers 1

addVariableUsageFunction · 0.85

Calls 4

getStateFunction · 0.70
getMethod · 0.45
setMethod · 0.45
addMethod · 0.45

Tested by

no test coverage detected