Skip to content

Commit

Permalink
Reduce public type of to be typed as , to avoid exposing an internal …
Browse files Browse the repository at this point in the history
…implementation detail.
  • Loading branch information
renggli committed Feb 29, 2024
1 parent 20ba2c1 commit 249c55a
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions lib/src/expression/builder.dart
Original file line number Diff line number Diff line change
Expand Up @@ -73,15 +73,15 @@ class ExpressionBuilder<T> {

/// The parser for this expression builder. Can be used to loop back to this
/// parser.
SettableParser<T> get loopback => _loopback;
Parser<T> get loopback => _loopback;

/// Defines a new primitive, literal, or value [parser].
void primitive(Parser<T> parser) => _primitives.add(parser);

/// Creates a new group of operators that share the same priority.
@useResult
ExpressionGroup<T> group() {
final group = ExpressionGroup<T>(loopback);
final group = ExpressionGroup<T>(_loopback);
_groups.add(group);
return group;
}
Expand All @@ -98,15 +98,15 @@ class ExpressionBuilder<T> {
buildChoice(primitives),
(parser, group) => group.build(parser),
);
// Replace all uses of `loopback` with `parser`. Do not use `resolve()`
// Replace all uses of `_loopback` with `parser`. Do not use `resolve()`
// because that might try to resolve unrelated parsers outside of the scope
// of the `ExpressionBuilder` and cause infinite recursion.
for (final parent in allParser(parser)) {
parent.replace(loopback, parser);
parent.replace(_loopback, parser);
}
// Also update the loopback parser, just in case somebody keeps a reference
// Also update the `_loopback` parser, just in case somebody keeps a reference
// to it (not that anybody should do that).
loopback.set(parser);
_loopback.set(parser);
return parser;
}
}

0 comments on commit 249c55a

Please sign in to comment.