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

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

Issue 23060025: Simplify the generated code for a message. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 4 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 | « no previous file | pkg/intl/lib/src/intl_message.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/intl/lib/message_lookup_by_library.dart
diff --git a/pkg/intl/lib/message_lookup_by_library.dart b/pkg/intl/lib/message_lookup_by_library.dart
index 2e92dbd9a9a25d2120a5128876efc000d544628c..c4107dcc752906a7d15f9c419a5a75632c9c8449 100644
--- a/pkg/intl/lib/message_lookup_by_library.dart
+++ b/pkg/intl/lib/message_lookup_by_library.dart
@@ -97,23 +97,9 @@ abstract class MessageLookupByLibrary {
String lookupMessage(String message_str, [final String desc='',
final Map examples=const {}, String locale,
String name, List<String> args]) {
- // If we don't have a name, return the original, and if we have
- // been recursively invoked, also just return message_str. This
- // happens because the replacement functions also call Intl.message,
- // so we assume that when _lookupInProgress is true that we're
- // already translated.
- if (name == null || _lookupInProgress) return message_str;
- _lookupInProgress = true;
- // Try to apply the function holding the translated version. If there
- // is an exception, use the original [message_str] as the result.
- var result = message_str;
- try {
- var function = this[name];
- if (function != null) result = Function.apply(function, args);
- } finally {
- _lookupInProgress = false;
- }
- return result;
+ if (name == null) return message_str;
+ var function = this[name];
+ return function == null ? message_str : Function.apply(function, args);
}
/** Return our message with the given name */
« no previous file with comments | « no previous file | pkg/intl/lib/src/intl_message.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698