MCPcopy
hub / github.com/adobe/react-spectrum / fn

Function fn

packages/dev/parcel-packager-docs/DocsPackager.js:82–216  ·  view source on GitHub ↗
(t, k)

Source from the content-addressed store, hash-verified

80 let paramStack = [];
81 let keyStack = [];
82 let fn = (t, k) => {
83 if (t && t.type === 'reference') {
84 let dep = bundleGraph
85 .getDependencies(asset)
86 .find(d => d.specifier === t.specifier && !bundleGraph.isDependencySkipped(d));
87 let res = bundleGraph.getResolvedAsset(dep, bundle);
88 let result = res ? processAsset(res)[t.imported] : null;
89 if (result) {
90 t = result;
91 } else {
92 return {
93 type: 'identifier',
94 name: t.local
95 };
96 }
97 }
98
99 if (t && t.type === 'application') {
100 application = t.typeParameters.map(item => fn(item, 'typeParameters'));
101 }
102
103 let hasParams = false;
104 if (
105 t &&
106 (t.type === 'alias' || t.type === 'interface') &&
107 t.typeParameters &&
108 application &&
109 shouldMerge(t, k, keyStack)
110 ) {
111 let params = Object.assign({}, paramStack[paramStack.length - 1]);
112 t.typeParameters.forEach((p, i) => {
113 let v = application[i] || p.default;
114 params[p.name] = v;
115 });
116 paramStack.push(params);
117 // so we don't replace the type parameters in the extended interface
118 application = null;
119 hasParams = true;
120 } else if (
121 t &&
122 (t.type === 'alias' || t.type === 'interface' || t.type === 'component') &&
123 t.typeParameters &&
124 keyStack.length === 0
125 ) {
126 // If we are at a root export, replace type parameters with constraints if possible.
127 // Seeing `DateValue` (as in `T extends DateValue`) is nicer than just `T`.
128 let typeParameters = t.typeParameters.map(item => fn(item, 'typeParameters'));
129 let params = Object.assign({}, paramStack[paramStack.length - 1]);
130 typeParameters.forEach(p => {
131 if (!params[p.name] && p.constraint) {
132 params[p.name] = p.constraint;
133 }
134 });
135 paramStack.push(params);
136 hasParams = true;
137 }
138
139 keyStack.push(k);

Callers 15

handlerFunction · 0.85
cachedFunction · 0.85
useValueEffectFunction · 0.85
runAfterTransitionFunction · 0.85
queueUpdateMethod · 0.85
WrapperFunction · 0.85
useScrollViewFunction · 0.85
dispatchFetchFunction · 0.85
toRGBMethod · 0.85
toRGBMethod · 0.85
runWithWrapUpdateMethod · 0.85

Calls 7

processAssetFunction · 0.85
shouldMergeFunction · 0.85
omitFunction · 0.85
pickFunction · 0.85
mergeInterfaceFunction · 0.85
pushMethod · 0.80
recurseFunction · 0.70

Tested by

no test coverage detected