Chromium Code Reviews| Index: compiler/java/com/google/dart/compiler/type/TypeAnalyzer.java |
| diff --git a/compiler/java/com/google/dart/compiler/type/TypeAnalyzer.java b/compiler/java/com/google/dart/compiler/type/TypeAnalyzer.java |
| index 04d2b458412adf1a5743e3a2fd53112a240664d9..f6e07427c9ae98dbc4c1044e32023efb9679b6fa 100644 |
| --- a/compiler/java/com/google/dart/compiler/type/TypeAnalyzer.java |
| +++ b/compiler/java/com/google/dart/compiler/type/TypeAnalyzer.java |
| @@ -192,7 +192,6 @@ public class TypeAnalyzer implements DartCompilationPhase { |
| private final Type nullType; |
| private final InterfaceType functionType; |
| private final InterfaceType dynamicIteratorType; |
| - private final boolean developerModeChecks; |
| /** |
| * Keeps track of the number of nested catches, used to detect re-throws |
| @@ -204,7 +203,6 @@ public class TypeAnalyzer implements DartCompilationPhase { |
| ConcurrentHashMap<ClassElement, List<Element>> unimplementedElements, |
| Set<ClassElement> diagnosedAbstractClasses) { |
| this.context = context; |
| - this.developerModeChecks = context.getCompilerConfiguration().developerModeChecks(); |
| this.unimplementedElements = unimplementedElements; |
| this.types = Types.getInstance(typeProvider); |
| this.dynamicType = typeProvider.getDynamicType(); |
| @@ -1119,10 +1117,9 @@ public class TypeAnalyzer implements DartCompilationPhase { |
| // Check the map literal entries against the return type. |
| Type valueType = type.getArguments().get(1); |
| for (DartMapLiteralEntry literalEntry : node.getEntries()) { |
| - boolean result = checkAssignable(literalEntry, typeOf(literalEntry), valueType); |
| - if (developerModeChecks == true && result == false) { |
| - typeError(literalEntry, ResolverErrorCode.MAP_LITERAL_ELEMENT_TYPE, |
| - valueType.toString()); |
| + boolean isValueAssignable = checkAssignable(literalEntry, typeOf(literalEntry), valueType); |
| + if (!isValueAssignable) { |
|
zundel
2012/02/29 22:51:59
developer mode checks are important here, because
scheglov
2012/02/29 23:14:55
Should I just change this to be an type warning?
zundel
2012/02/29 23:24:51
No, it is a compile-time error if developer mode i
scheglov
2012/02/29 23:46:59
OK, restored.
|
| + typeError(literalEntry, ResolverErrorCode.MAP_LITERAL_ELEMENT_TYPE, valueType); |
| } |
| } |
| @@ -1716,10 +1713,9 @@ public class TypeAnalyzer implements DartCompilationPhase { |
| InterfaceType type = node.getType(); |
| Type elementType = type.getArguments().get(0); |
| for (DartExpression expression : node.getExpressions()) { |
| - boolean result = checkAssignable(elementType, expression); |
| - if (developerModeChecks == true && result == false) { |
| - typeError(expression, ResolverErrorCode.LIST_LITERAL_ELEMENT_TYPE, |
| - elementType.toString()); |
| + boolean isValueAssignable = checkAssignable(elementType, expression); |
| + if (!isValueAssignable) { |
| + typeError(expression, ResolverErrorCode.LIST_LITERAL_ELEMENT_TYPE, elementType); |
| } |
| } |
| return type; |