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