( bloomHash: number, injectorIndex: number, injectorView: LView | TData, )
| 847 | } |
| 848 | |
| 849 | export function bloomHasToken( |
| 850 | bloomHash: number, |
| 851 | injectorIndex: number, |
| 852 | injectorView: LView | TData, |
| 853 | ) { |
| 854 | // Create a mask that targets the specific bit associated with the directive we're looking for. |
| 855 | // JS bit operations are 32 bits, so this will be a number between 2^0 and 2^31, corresponding |
| 856 | // to bit positions 0 - 31 in a 32 bit integer. |
| 857 | const mask = 1 << bloomHash; |
| 858 | |
| 859 | // Each bloom bucket in `injectorView` represents `BLOOM_BUCKET_BITS` number of bits of |
| 860 | // `bloomHash`. Any bits in `bloomHash` beyond `BLOOM_BUCKET_BITS` indicate the bucket offset |
| 861 | // that should be used. |
| 862 | const value = injectorView[injectorIndex + (bloomHash >> BLOOM_BUCKET_BITS)]; |
| 863 | |
| 864 | // If the bloom filter value has the bit corresponding to the directive's bloomBit flipped on, |
| 865 | // this injector is a potential match. |
| 866 | return !!(value & mask); |
| 867 | } |
| 868 | |
| 869 | /** Returns true if flags prevent parent injector from being searched for tokens */ |
| 870 | function shouldSearchParent( |
no outgoing calls
no test coverage detected
searching dependent graphs…