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

Unified Diff: sdk/lib/_internal/compiler/implementation/compile_time_constants.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
« no previous file with comments | « no previous file | sdk/lib/_internal/compiler/implementation/compiler.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/_internal/compiler/implementation/compile_time_constants.dart
diff --git a/sdk/lib/_internal/compiler/implementation/compile_time_constants.dart b/sdk/lib/_internal/compiler/implementation/compile_time_constants.dart
index c805e1ebe277aff27c3dedffe8ff507a94fa4db1..3f1313affdcb2f339dd10161ca8c06aee99abab0 100644
--- a/sdk/lib/_internal/compiler/implementation/compile_time_constants.dart
+++ b/sdk/lib/_internal/compiler/implementation/compile_time_constants.dart
@@ -148,7 +148,7 @@ class ConstantHandler extends CompilerTask {
if (isConst) {
MessageKind kind = MessageKind.CYCLIC_COMPILE_TIME_CONSTANTS;
compiler.reportError(node,
- new CompileTimeConstantError(kind, const []));
+ new CompileTimeConstantError(kind));
} else {
lazyStatics.add(element);
return null;
@@ -173,9 +173,9 @@ class ConstantHandler extends CompilerTask {
if (elementType.isMalformed || constantType.isMalformed ||
!constantSystem.isSubtype(compiler, constantType, elementType)) {
if (isConst) {
- MessageKind kind = MessageKind.NOT_ASSIGNABLE;
compiler.reportError(node, new CompileTimeConstantError(
- kind, [elementType, constantType]));
+ MessageKind.NOT_ASSIGNABLE,
+ {'fromType': elementType, 'toType': constantType}));
} else {
// If the field can be lazily initialized, we will throw
// the exception at runtime.
@@ -354,7 +354,7 @@ class CompileTimeConstantEvaluator extends Visitor {
Constant key = evaluateConstant(entry.key);
if (!key.isString() || entry.key.asStringNode() == null) {
MessageKind kind = MessageKind.KEY_NOT_A_STRING_LITERAL;
- compiler.reportError(entry.key, new ResolutionError(kind, const []));
+ compiler.reportError(entry.key, new ResolutionError(kind));
}
StringConstant keyConstant = key;
if (!map.containsKey(key)) keys.add(key);
@@ -468,7 +468,7 @@ class CompileTimeConstantEvaluator extends Visitor {
&& element.isVariable()
&& element.modifiers.isConst()) {
Constant result = handler.compileConstant(element);
- if (result != null) return result;
+ if (result != null) return result;
}
return signalNotCompileTimeConstant(send);
} else if (send.isCall) {
@@ -624,7 +624,7 @@ class CompileTimeConstantEvaluator extends Visitor {
if (!succeeded) {
MessageKind kind = MessageKind.INVALID_ARGUMENTS;
compiler.reportError(node,
- new CompileTimeConstantError(kind, [target.name.slowToString()]));
+ new CompileTimeConstantError(kind, {'methodName': target.name}));
}
return compiledArguments;
}
@@ -672,7 +672,7 @@ class CompileTimeConstantEvaluator extends Visitor {
// TODO(floitsch): get the list of constants that are currently compiled
// and present some kind of stack-trace.
MessageKind kind = MessageKind.NOT_A_COMPILE_TIME_CONSTANT;
- compiler.reportError(node, new CompileTimeConstantError(kind, const []));
+ compiler.reportError(node, new CompileTimeConstantError(kind));
}
Constant signalNotCompileTimeConstant(Node node) {
@@ -697,7 +697,7 @@ class TryCompileTimeConstantEvaluator extends CompileTimeConstantEvaluator {
error(Node node) {
// Just fail without reporting it anywhere.
throw new CompileTimeConstantError(
- MessageKind.NOT_A_COMPILE_TIME_CONSTANT, const []);
+ MessageKind.NOT_A_COMPILE_TIME_CONSTANT);
}
}
@@ -745,9 +745,9 @@ class ConstructorEvaluator extends CompileTimeConstantEvaluator {
if (elementType.element.isTypeVariable()) return;
if (elementType.isMalformed || constantType.isMalformed ||
!constantSystem.isSubtype(compiler, constantType, elementType)) {
- MessageKind kind = MessageKind.NOT_ASSIGNABLE;
compiler.reportError(node, new CompileTimeConstantError(
- kind, [elementType, constantType]));
+ MessageKind.NOT_ASSIGNABLE,
+ {'fromType': elementType, 'toType': constantType}));
}
}
}
« no previous file with comments | « no previous file | sdk/lib/_internal/compiler/implementation/compiler.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698