From 73663f274c3e08f9604ef4d56c508ff89ce1f47d Mon Sep 17 00:00:00 2001 From: Boshen Date: Tue, 21 Feb 2023 10:01:02 +0800 Subject: [PATCH] perf(parser): inline all methods on `Context` --- crates/oxc_ast/src/context.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/crates/oxc_ast/src/context.rs b/crates/oxc_ast/src/context.rs index 7d5e6cde9..03c3df4d1 100644 --- a/crates/oxc_ast/src/context.rs +++ b/crates/oxc_ast/src/context.rs @@ -101,56 +101,67 @@ impl Context { } #[must_use] + #[inline] pub const fn union_await_if(self, include: bool) -> Self { self.union_if(Self::Await, include) } #[must_use] + #[inline] pub const fn union_yield_if(self, include: bool) -> Self { self.union_if(Self::Yield, include) } #[must_use] + #[inline] const fn union_if(self, other: Self, include: bool) -> Self { if include { self.union(other) } else { self } } #[must_use] + #[inline] pub fn and_in(self, include: bool) -> Self { self.and(Self::In, include) } #[must_use] + #[inline] pub fn and_yield(self, include: bool) -> Self { self.and(Self::Yield, include) } #[must_use] + #[inline] pub fn and_await(self, include: bool) -> Self { self.and(Self::Await, include) } #[must_use] + #[inline] pub fn and_return(self, include: bool) -> Self { self.and(Self::Return, include) } #[must_use] + #[inline] pub fn and_disallow_conditional_types(self, include: bool) -> Self { self.and(Self::DisallowConditionalTypes, include) } #[must_use] + #[inline] pub fn and_ambient(self, include: bool) -> Self { self.and(Self::Ambient, include) } #[must_use] + #[inline] pub fn and_decorator(self, include: bool) -> Self { self.and(Self::Decorator, include) } #[must_use] + #[inline] fn and(self, flag: Self, set: bool) -> Self { if set { self | flag } else { self - flag } }