Skip to content

Commit 1dc27b2

Browse files
committed
refactor: rename replace methods to stringReplaceAll
1 parent 1ed51f1 commit 1dc27b2

1 file changed

Lines changed: 14 additions & 13 deletions

File tree

packages/cloud_firestore/cloud_firestore/lib/src/pipeline_expression.dart

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -371,14 +371,15 @@ abstract class Expression implements PipelineSerializable {
371371
return _SubstringExpression(this, Constant(start), Constant(end));
372372
}
373373

374-
/// Replaces occurrences of a pattern in this string
375-
Expression replace(Expression find, Expression replacement) {
376-
return _ReplaceExpression(this, find, replacement);
374+
/// Replaces all occurrences of a pattern in this string (stringReplaceAll)
375+
Expression stringReplaceAll(Expression find, Expression replacement) {
376+
return _StringReplaceAllExpression(this, find, replacement);
377377
}
378378

379-
/// Replaces occurrences of a string literal
380-
Expression replaceLiteral(String find, String replacement) {
381-
return _ReplaceExpression(this, Constant(find), Constant(replacement));
379+
/// Replaces all occurrences of a string literal
380+
Expression stringReplaceAllLiteral(String find, String replacement) {
381+
return _StringReplaceAllExpression(
382+
this, Constant(find), Constant(replacement));
382383
}
383384

384385
/// Splits this string expression by a delimiter
@@ -1263,13 +1264,13 @@ abstract class Expression implements PipelineSerializable {
12631264
return _SubstringExpression(stringExpr, start, end);
12641265
}
12651266

1266-
/// Replaces in string
1267-
static Expression replaceStatic(
1267+
/// Replaces all occurrences in string (stringReplaceAll)
1268+
static Expression stringReplaceAllStatic(
12681269
Expression stringExpr,
12691270
Expression find,
12701271
Expression replacement,
12711272
) {
1272-
return _ReplaceExpression(stringExpr, find, replacement);
1273+
return _StringReplaceAllExpression(stringExpr, find, replacement);
12731274
}
12741275

12751276
/// Splits string
@@ -1631,16 +1632,16 @@ class _SubstringExpression extends FunctionExpression {
16311632
}
16321633
}
16331634

1634-
/// Represents a replace function expression
1635-
class _ReplaceExpression extends FunctionExpression {
1635+
/// Represents a string_replace_all function expression
1636+
class _StringReplaceAllExpression extends FunctionExpression {
16361637
final Expression expression;
16371638
final Expression find;
16381639
final Expression replacement;
16391640

1640-
_ReplaceExpression(this.expression, this.find, this.replacement);
1641+
_StringReplaceAllExpression(this.expression, this.find, this.replacement);
16411642

16421643
@override
1643-
String get name => 'replace';
1644+
String get name => 'string_replace_all';
16441645

16451646
@override
16461647
Map<String, dynamic> toMap() {

0 commit comments

Comments
 (0)