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

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

Issue 13898014: Allow suppressing message extraction warnings, providing a prefix for generated files, and format w… (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: More fixes Created 7 years, 8 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/generate_localized.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 fb57341bcb159a6814804312aff2e9e8d97d6a49..47bcbbbeb5d4a6270dcdb72f85cb7ab898c1c6c0 100755
--- a/pkg/intl/lib/extract_messages.dart
+++ b/pkg/intl/lib/extract_messages.dart
@@ -32,6 +32,12 @@ import 'dart:io';
import 'package:intl/src/intl_message.dart';
/**
+ * If this is true, print warnings for skipped messages. Otherwise, warnings
+ * are suppressed.
+ */
+bool suppressWarnings = false;
+
+/**
* Parse the dart program represented in [sourceCode] and return a Map from
* message names to [IntlMessage] instances. The [origin] is a string
* describing where the source came from, and is used in error messages.
@@ -195,9 +201,9 @@ class MessageFindingVisitor extends GeneralizingASTVisitor {
void addIntlMessage(MethodInvocation node) {
if (!looksLikeIntlMessage(node)) return;
var reason = checkValidity(node);
- if (!(reason == null)) {
+ if (reason != null && !suppressWarnings) {
print("Skipping invalid Intl.message invocation\n <$node>");
- print(" reason: $reason");
+ print(" reason: $reason");
reportErrorLocation(node);
return;
}
@@ -227,11 +233,11 @@ class MessageFindingVisitor extends GeneralizingASTVisitor {
}
void reportErrorLocation(ASTNode node) {
- if (origin != null) print("from $origin");
+ if (origin != null) print(" from $origin");
LineInfo info = root.lineInfo;
if (info != null) {
LineInfo_Location line = info.getLocation(node.offset);
- print("line: ${line.lineNumber}, column: ${line.columnNumber}");
+ print(" line: ${line.lineNumber}, column: ${line.columnNumber}");
}
}
}
« no previous file with comments | « no previous file | pkg/intl/lib/generate_localized.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698