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

Unified Diff: compiler/java/com/google/dart/compiler/type/TypeAnalyzer.java

Issue 10889009: Issue 4764. Rollback List/Map literals type inference (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 4 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 | compiler/javatests/com/google/dart/compiler/type/TypeAnalyzerCompilerTest.java » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 35cda0e7ae6b7ccdd29f6d9bee75e6f2de8d9a20..a53b106bcdbb09036a6a6816e2175bc331461463 100644
--- a/compiler/java/com/google/dart/compiler/type/TypeAnalyzer.java
+++ b/compiler/java/com/google/dart/compiler/type/TypeAnalyzer.java
@@ -163,7 +163,6 @@ public class TypeAnalyzer implements DartCompilationPhase {
@VisibleForTesting
static class Analyzer extends ASTVisitor<Type> {
- private final CoreTypeProvider typeProvider;
private final DynamicType dynamicType;
private final Type stringType;
private final InterfaceType defaultLiteralMapType;
@@ -200,7 +199,6 @@ public class TypeAnalyzer implements DartCompilationPhase {
Analyzer(DartCompilerContext context, CoreTypeProvider typeProvider,
Set<ClassElement> diagnosedAbstractClasses) {
this.context = context;
- this.typeProvider = typeProvider;
this.developerModeChecks = context.getCompilerConfiguration().developerModeChecks();
this.types = Types.getInstance(typeProvider);
this.dynamicType = typeProvider.getDynamicType();
@@ -1851,24 +1849,6 @@ public class TypeAnalyzer implements DartCompilationPhase {
}
}
- // infer type of constant literal
- if (node.isConst() && node.getTypeArguments().isEmpty()) {
- List<Type> valueTypes = Lists.newArrayList();
- for (DartMapLiteralEntry literalEntry : node.getEntries()) {
- DartExpression value = literalEntry.getValue();
- if (value != null) {
- Type valueType = typeOf(value);
- if (valueType != null ) {
- valueTypes.add(valueType);
- }
- }
- }
- Type valueType = types.intersection(valueTypes);
- valueType = Types.makeInferred(valueType);
- InterfaceType mapLiteralType = typeProvider.getMapLiteralType(stringType, valueType);
- return Types.makeInferred(mapLiteralType);
- }
-
return type;
}
@@ -2705,21 +2685,6 @@ public class TypeAnalyzer implements DartCompilationPhase {
}
}
}
- // infer type of constant literal
- if (node.isConst() && node.getTypeArguments().isEmpty()) {
- List<Type> elementTypes = Lists.newArrayList();
- for (DartExpression expression : node.getExpressions()) {
- Type elementType = expression.getType();
- if (elementType != null ) {
- elementTypes.add(elementType);
- }
- }
- Type elementType = types.intersection(elementTypes);
- elementType = Types.makeInferred(elementType);
- InterfaceType arrayLiteralType = typeProvider.getArrayLiteralType(elementType);
- return Types.makeInferred(arrayLiteralType);
- }
- // done
return interfaceType;
}
« no previous file with comments | « no previous file | compiler/javatests/com/google/dart/compiler/type/TypeAnalyzerCompilerTest.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698