@@ -49,7 +49,7 @@ export type CCPinMultiplexability =
4949 | { isMultiplexable : true }
5050 | {
5151 isMultiplexable : false ;
52- getMultiplicity : ( nodePins : CCNodePin [ ] ) => number ;
52+ multiplicity : number ;
5353 } ;
5454// | { isMultiplexable: false; multiplicity: number };
5555
@@ -243,6 +243,7 @@ export class CCComponentPinStore extends EventEmitter<CCComponentPinStoreEvents>
243243 */
244244 getComponentPinMultiplexability (
245245 pinId : CCComponentPinId ,
246+ nodePins : CCNodePin [ ] ,
246247 ) : CCComponentPinMultiplexability {
247248 const pin = this . #pins. get ( pinId ) ;
248249 invariant ( pin ) ;
@@ -268,52 +269,46 @@ export class CCComponentPinStore extends EventEmitter<CCComponentPinStoreEvents>
268269 return "undecidable" ;
269270 }
270271 case nullthrows ( aggregate . outputPin . id ) : {
271- const getMultiplicity = ( nodePins : CCNodePin [ ] ) : number => {
272- const multiplicity = nodePins
273- . filter ( ( pin ) => {
274- const componentPin = this . #store. componentPins . get (
275- pin . componentPinId ,
276- ) ;
277- invariant ( componentPin ) ;
278- return componentPin . type === "input" ;
279- } )
280- . reduce ( ( acc , pin ) => {
281- invariant ( pin . userSpecifiedBitWidth ) ;
282- return acc + pin . userSpecifiedBitWidth ;
283- } , 0 ) ;
284- return multiplicity ;
285- } ;
272+ const multiplicity = nodePins
273+ . filter ( ( pin ) => {
274+ const componentPin = this . #store. componentPins . get (
275+ pin . componentPinId ,
276+ ) ;
277+ invariant ( componentPin ) ;
278+ return componentPin . type === "input" ;
279+ } )
280+ . reduce ( ( acc , pin ) => {
281+ invariant ( pin . userSpecifiedBitWidth ) ;
282+ return acc + pin . userSpecifiedBitWidth ;
283+ } , 0 ) ;
286284 return {
287285 isMultiplexable : false ,
288- getMultiplicity ,
286+ multiplicity ,
289287 } ;
290288 }
291289 case nullthrows ( decompose . outputPin . id ) : {
292290 return "undecidable" ;
293291 }
294292 case nullthrows ( decompose . inputPin . In . id ) : {
295- const getMultiplicity = ( nodePins : CCNodePin [ ] ) : number => {
296- const multiplicity = nodePins
297- . filter ( ( pin ) => {
298- const componentPin = this . #store. componentPins . get (
299- pin . componentPinId ,
300- ) ;
301- invariant ( componentPin ) ;
302- return componentPin . type === "output" ;
303- } )
304- . reduce ( ( acc , pin ) => {
305- invariant ( pin . userSpecifiedBitWidth ) ;
306- return acc + pin . userSpecifiedBitWidth ;
307- } , 0 ) ;
308- return multiplicity ;
309- } ;
293+ const multiplicity = nodePins
294+ . filter ( ( pin ) => {
295+ const componentPin = this . #store. componentPins . get (
296+ pin . componentPinId ,
297+ ) ;
298+ invariant ( componentPin ) ;
299+ return componentPin . type === "output" ;
300+ } )
301+ . reduce ( ( acc , pin ) => {
302+ invariant ( pin . userSpecifiedBitWidth ) ;
303+ return acc + pin . userSpecifiedBitWidth ;
304+ } , 0 ) ;
310305 return {
311306 isMultiplexable : false ,
312- getMultiplicity ,
307+ multiplicity ,
313308 } ;
314309 }
315310 case nullthrows ( broadcast . inputPin . In . id ) : {
316- return { isMultiplexable : false , getMultiplicity : ( ) => 1 } ;
311+ return { isMultiplexable : false , multiplicity : 1 } ;
317312 }
318313 case nullthrows ( broadcast . outputPin . id ) : {
319314 return "undecidable" ;
0 commit comments