Skip to content

Commit 38caedb

Browse files
JasperDeSutteralerque
authored andcommitted
docs(fluent-bundle): Improve documentation in resolver code
1 parent ba262b5 commit 38caedb

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

fluent-bundle/src/resolver/pattern.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,8 @@ impl<'bundle> ResolveValue<'bundle> for ast::Pattern<&'bundle str> {
9191
{
9292
let len = self.elements.len();
9393

94-
// more than 1 element means concatenation, which is more efficient to write to a String
95-
// 1 element often means just a message reference that can be passed back as a Cow::Borrowed
94+
// If there is only 1 element, then it is more efficient to attempt to resolve as a message
95+
// reference that can be passed back as a Cow::Borrowed rather than writing a new String.
9696
if len == 1 {
9797
match &self.elements[0] {
9898
&ast::PatternElement::TextElement { value } => {

fluent-bundle/src/resolver/scope.rs

+4
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,10 @@ impl<'bundle, 'ast, 'args, 'errors, R, M> Scope<'bundle, 'ast, 'args, 'errors, R
7878
}
7979
}
8080

81+
/// Cyclic pattern reference detection used in expression resolvers.
82+
///
83+
/// Writes an error as soon as an identical pattern is encountered more than once,
84+
/// which would lead to an infinite loop.
8185
pub fn track<W>(
8286
&mut self,
8387
w: &mut W,

0 commit comments

Comments
 (0)