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

Unified Diff: sdk/lib/_internal/compiler/implementation/typechecker.dart

Issue 12082024: Use named arguments for messages. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Rebased Created 7 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
Index: sdk/lib/_internal/compiler/implementation/typechecker.dart
diff --git a/sdk/lib/_internal/compiler/implementation/typechecker.dart b/sdk/lib/_internal/compiler/implementation/typechecker.dart
index c826241e078c99817970d818462abb6fc508f753..5a85c7882b7b8e6bd500061dc03f425109816916 100644
--- a/sdk/lib/_internal/compiler/implementation/typechecker.dart
+++ b/sdk/lib/_internal/compiler/implementation/typechecker.dart
@@ -739,7 +739,7 @@ class TypeCheckerVisitor implements Visitor<DartType> {
throw new CancelTypeCheckException(node, message);
}
- reportTypeWarning(Node node, MessageKind kind, [List arguments = const []]) {
+ reportTypeWarning(Node node, MessageKind kind, [Map arguments = const {}]) {
compiler.reportWarning(node, new TypeWarning(kind, arguments));
}
@@ -784,7 +784,8 @@ class TypeCheckerVisitor implements Visitor<DartType> {
*/
checkAssignable(Node node, DartType s, DartType t) {
if (!types.isAssignable(s, t)) {
- reportTypeWarning(node, MessageKind.NOT_ASSIGNABLE, [s, t]);
+ reportTypeWarning(node, MessageKind.NOT_ASSIGNABLE,
+ {'fromType': s, 'toType': t});
}
}
@@ -924,7 +925,7 @@ class TypeCheckerVisitor implements Visitor<DartType> {
return computeType(member);
}
reportTypeWarning(node, MessageKind.METHOD_NOT_FOUND,
- [classElement.name, name]);
+ {'className': classElement.name, 'methodName': name});
return types.dynamicType;
}
@@ -948,7 +949,7 @@ class TypeCheckerVisitor implements Visitor<DartType> {
reportTypeWarning(arguments.head, MessageKind.ADDITIONAL_ARGUMENT);
} else if (!parameterTypes.isEmpty) {
reportTypeWarning(send, MessageKind.MISSING_ARGUMENT,
- [parameterTypes.head]);
+ {'argumentType': parameterTypes.head});
}
}
}
@@ -1156,8 +1157,7 @@ class TypeCheckerVisitor implements Visitor<DartType> {
final expressionType = analyze(expression);
if (isVoidFunction
&& !types.isAssignable(expressionType, types.voidType)) {
- reportTypeWarning(expression, MessageKind.RETURN_VALUE_IN_VOID,
- [expressionType]);
+ reportTypeWarning(expression, MessageKind.RETURN_VALUE_IN_VOID);
} else {
checkAssignable(expression, expectedReturnType, expressionType);
}
@@ -1168,7 +1168,8 @@ class TypeCheckerVisitor implements Visitor<DartType> {
// - f is not a generative constructor.
// - The return type of f may not be assigned to void.
} else if (!types.isAssignable(expectedReturnType, types.voidType)) {
- reportTypeWarning(node, MessageKind.RETURN_NOTHING, [expectedReturnType]);
+ reportTypeWarning(node, MessageKind.RETURN_NOTHING,
+ {'returnType': expectedReturnType});
}
return StatementType.RETURNING;
}
« no previous file with comments | « sdk/lib/_internal/compiler/implementation/ssa/builder.dart ('k') | sdk/lib/_internal/compiler/implementation/types/types.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698