Skip to content

Commit

Permalink
Only compute stc fields if not present
Browse files Browse the repository at this point in the history
  • Loading branch information
mik-jozef committed Nov 17, 2023
1 parent ad9c2cd commit eed907b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/pattern/match.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ export abstract class MatchBase extends CompositePattern {

grammar.cachedRuleSources.set(stc, nt);

stc.fields = CompositePattern.getFields(stc.pattern);
stc.fields ??= CompositePattern.getFields(stc.pattern);

CompositePattern.toGrammarRule(stc.pattern, grammar, stc.name, nt);

Expand All @@ -116,7 +116,7 @@ export abstract class MatchBase extends CompositePattern {
this.match.pattern instanceof CompositePattern &&
this.match.pattern.collectSyntaxTreeClasses(map);

this.match.fields = CompositePattern.getFields(this.match.pattern);
this.match.fields ??= CompositePattern.getFields(this.match.pattern);
}

this.match instanceof CompositePattern &&
Expand Down

0 comments on commit eed907b

Please sign in to comment.