Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(84)

Unified Diff: pkg/intl/lib/bidi_utils.dart

Issue 140843002: [Intl] Cleanup some code (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: integrate feedback Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/intl/lib/bidi_formatter.dart ('k') | pkg/intl/lib/date_format.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/intl/lib/bidi_utils.dart
diff --git a/pkg/intl/lib/bidi_utils.dart b/pkg/intl/lib/bidi_utils.dart
index e4599dabda8ff5c14acd3209cb7377db212dcffd..9141bda15b3e4b7f5feae31a3c973be64150ba1b 100644
--- a/pkg/intl/lib/bidi_utils.dart
+++ b/pkg/intl/lib/bidi_utils.dart
@@ -45,9 +45,8 @@ class TextDirection {
* Returns true if [otherDirection] is known to be different from this
* direction.
*/
- bool isDirectionChange(TextDirection otherDirection) {
- return otherDirection != TextDirection.UNKNOWN && this != otherDirection;
- }
+ bool isDirectionChange(TextDirection otherDirection) =>
+ otherDirection != TextDirection.UNKNOWN && this != otherDirection;
}
/**
@@ -198,17 +197,14 @@ class Bidi {
* will override existing one in behavior (should work on Chrome, FF, and IE
* since this was ported directly from the Closure version).
*/
- static String enforceRtlInHtml(String html) {
- return _enforceInHtmlHelper(html, 'rtl');
- }
+ static String enforceRtlInHtml(String html) =>
+ _enforceInHtmlHelper(html, 'rtl');
/**
* Enforce RTL on both end of the given [text] using unicode BiDi formatting
* characters RLE and PDF.
*/
- static String enforceRtlInText(String text) {
- return '$RLE$text$PDF';
- }
+ static String enforceRtlInText(String text) => '$RLE$text$PDF';
/**
* Enforce the [html] snippet in LTR directionality regardless of overall
@@ -218,17 +214,14 @@ class Bidi {
* the whole piece. If the tag already has a direction specified, this new one
* will override existing one in behavior (tested on FF and IE).
*/
- static String enforceLtrInHtml(String html) {
- return _enforceInHtmlHelper(html, 'ltr');
- }
+ static String enforceLtrInHtml(String html) =>
+ _enforceInHtmlHelper(html, 'ltr');
/**
* Enforce LTR on both end of the given [text] using unicode BiDi formatting
* characters LRE and PDF.
*/
- static String enforceLtrInText(String text) {
- return '$LRE$text$PDF';
- }
+ static String enforceLtrInText(String text) => '$LRE$text$PDF';
/**
* Enforce the [html] snippet in the desired [direction] regardless of overall
@@ -294,16 +287,15 @@ class Bidi {
// See Issue 2979.
static String _guardBracketHelper(String str, RegExp regexp, [String before,
String after]) {
- StringBuffer buffer = new StringBuffer();
+ var buffer = new StringBuffer();
var startIndex = 0;
- Iterable matches = regexp.allMatches(str);
- for (Match match in matches) {
+ regexp.allMatches(str).forEach((match) {
buffer..write(str.substring(startIndex, match.start))
..write(before)
..write(str.substring(match.start, match.end))
..write(after);
startIndex = match.end;
- }
+ });
return (buffer..write(str.substring(startIndex))).toString();
}
@@ -382,7 +374,6 @@ class Bidi {
* text should be laid out in RTL direction. If [isHtml] is true, the string
* is HTML or HTML-escaped.
*/
- static bool detectRtlDirectionality(String str, {bool isHtml: false}) {
- return estimateDirectionOfText(str, isHtml: isHtml) == TextDirection.RTL;
- }
+ static bool detectRtlDirectionality(String str, {bool isHtml: false}) =>
+ estimateDirectionOfText(str, isHtml: isHtml) == TextDirection.RTL;
}
« no previous file with comments | « pkg/intl/lib/bidi_formatter.dart ('k') | pkg/intl/lib/date_format.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698