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

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

Issue 132963002: Read Intl.message examples argument as a map, not a string (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Tweaks for the test framework 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 | « no previous file | pkg/intl/lib/intl.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/intl/lib/extract_messages.dart
diff --git a/pkg/intl/lib/extract_messages.dart b/pkg/intl/lib/extract_messages.dart
index 8a6ad529ec09ffde15c899115227fef1abf949a7..66b2258b2287bd9f16bea293601f93801298f868 100644
--- a/pkg/intl/lib/extract_messages.dart
+++ b/pkg/intl/lib/extract_messages.dart
@@ -229,8 +229,11 @@ class MessageFindingVisitor extends GeneralizingASTVisitor {
for (var namedArgument in arguments.where((x) => x is NamedExpression)) {
var name = namedArgument.name.label.name;
var exp = namedArgument.expression;
- var string = exp is SimpleStringLiteral ? exp.value : exp.toString();
- setAttribute(message, name, string);
+ var evaluator = new ConstantEvaluator();
+ var basicValue = exp.accept(evaluator);
+ var value = basicValue == ConstantEvaluator.NOT_A_CONSTANT ?
+ exp.toString() : basicValue;
+ setAttribute(message, name, value);
}
return message;
}
@@ -258,7 +261,7 @@ class MessageFindingVisitor extends GeneralizingASTVisitor {
}
}
- void setValue(MainMessage message, String fieldName, String fieldValue) {
+ void setValue(MainMessage message, String fieldName, Object fieldValue) {
message[fieldName] = fieldValue;
}
« no previous file with comments | « no previous file | pkg/intl/lib/intl.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698