MCPcopy
hub / github.com/webpack/webpack / tagVariable

Method tagVariable

lib/javascript/JavascriptParser.js:5458–5487  ·  view source on GitHub ↗

* Processes the provided name. * @param {string} name name * @param {Tag} tag tag info * @param {TagData=} data data * @param {VariableInfoFlagsType=} flags flags

(name, tag, data, flags = VariableInfoFlags.Tagged)

Source from the content-addressed store, hash-verified

5456 * @param {VariableInfoFlagsType=} flags flags
5457 */
5458 tagVariable(name, tag, data, flags = VariableInfoFlags.Tagged) {
5459 const oldInfo = this.scope.definitions.get(name);
5460 /** @type {VariableInfo} */
5461 let newInfo;
5462 if (oldInfo === undefined) {
5463 newInfo = new VariableInfo(this.scope, name, flags, {
5464 tag,
5465 data,
5466 next: undefined
5467 });
5468 } else if (oldInfo instanceof VariableInfo) {
5469 newInfo = new VariableInfo(
5470 oldInfo.declaredScope,
5471 oldInfo.name,
5472 /** @type {VariableInfoFlagsType} */ (oldInfo.flags | flags),
5473 {
5474 tag,
5475 data,
5476 next: oldInfo.tagInfo
5477 }
5478 );
5479 } else {
5480 newInfo = new VariableInfo(oldInfo, name, flags, {
5481 tag,
5482 data,
5483 next: undefined
5484 });
5485 }
5486 this.scope.definitions.set(name, newInfo);
5487 }
5488
5489 /**
5490 * Processes the provided name.

Callers 9

handlerMethod · 0.80
handleConstValueMethod · 0.80
markPureMethod · 0.80
tagTopLevelSymbolFunction · 0.80
applyMethod · 0.80
applyMethod · 0.80
processItemMethod · 0.80
applyMethod · 0.80

Calls 2

getMethod · 0.45
setMethod · 0.45

Tested by

no test coverage detected