refactor(transformer/class-properties): prefer contains to intersects for bitflags (#7747)

Tiny refactor. `contains` is clearer than `intersects`, and they produce equivalent assembly when argument is a single flag value, and statically knowable.

https://godbolt.org/z/bTdfbv3f8
This commit is contained in:
overlookmotel 2024-12-09 16:09:24 +00:00
parent 463fc5f2de
commit 7e0f7eb67b

View file

@ -754,7 +754,7 @@ impl<'a, 'ctx> ClassProperties<'a, 'ctx> {
// Test for it in first pass over class elements, and avoid temp vars where possible.
match ctx.symbols().get_reference(ident.reference_id()).symbol_id() {
Some(symbol_id) => {
ctx.symbols().get_flags(symbol_id).intersects(SymbolFlags::ConstVariable)
ctx.symbols().get_flags(symbol_id).contains(SymbolFlags::ConstVariable)
|| ctx
.symbols()
.get_resolved_references(symbol_id)