perf: reorder expensive conditional operand
This commit is contained in:
parent
ad0f953c21
commit
5ed2c77b59
1 changed files with 8 additions and 7 deletions
|
|
@ -238,13 +238,14 @@ pub(crate) fn parse_grammar(input: &str) -> ParseGrammarResult<InputGrammar> {
|
||||||
let mut in_progress = HashSet::new();
|
let mut in_progress = HashSet::new();
|
||||||
|
|
||||||
for (name, rule) in &rules {
|
for (name, rule) in &rules {
|
||||||
if !variable_is_used(
|
if grammar_json.word.as_ref().is_none_or(|w| w != name)
|
||||||
&rules,
|
&& !variable_is_used(
|
||||||
&extra_symbols,
|
&rules,
|
||||||
&external_tokens,
|
&extra_symbols,
|
||||||
name,
|
&external_tokens,
|
||||||
&mut in_progress,
|
name,
|
||||||
) && grammar_json.word.as_ref().is_none_or(|w| w != name)
|
&mut in_progress,
|
||||||
|
)
|
||||||
{
|
{
|
||||||
grammar_json.conflicts.retain(|r| !r.contains(name));
|
grammar_json.conflicts.retain(|r| !r.contains(name));
|
||||||
grammar_json.supertypes.retain(|r| r != name);
|
grammar_json.supertypes.retain(|r| r != name);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue