Skip to content

Commit

Permalink
refactor(transformer/class-properties): prefer contains to `interse…
Browse files Browse the repository at this point in the history
…cts` 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
  • Loading branch information
overlookmotel committed Dec 9, 2024
1 parent 463fc5f commit 7e0f7eb
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 7e0f7eb

Please sign in to comment.