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

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

Issue 11364211: Type quality of ArrayAccess is same as quality of target type. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 1 month 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/java/com/google/dart/compiler/type/Types.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 aea700e14a613f28fb55767119aed87044f78714..49694ff9d1629c016479d627c9ab3d0cdf93f045 100644
--- a/compiler/java/com/google/dart/compiler/type/TypeAnalyzer.java
+++ b/compiler/java/com/google/dart/compiler/type/TypeAnalyzer.java
@@ -1398,7 +1398,8 @@ public class TypeAnalyzer implements DartCompilationPhase {
}
}
// print( t[k] )
- return analyzeBinaryOperator(node, target, Token.INDEX, node, argKey);
+ Type result = analyzeBinaryOperator(node, target, Token.INDEX, node, argKey);
+ return Types.makeInferred(result, target.getQuality());
}
/**
@@ -3571,11 +3572,18 @@ public class TypeAnalyzer implements DartCompilationPhase {
*/
public static TypeQuality getTypeQuality(DartExpression expr) {
if (expr != null) {
- if (expr instanceof DartMethodInvocation) {
- return TypeQuality.INFERRED;
+ if (expr instanceof DartIdentifier) {
+ Type varType = expr.getType();
+ if (varType != null) {
+ TypeQuality varTypeQuality = varType.getQuality();
+ if (varTypeQuality == TypeQuality.EXACT) {
+ varTypeQuality = TypeQuality.INFERRED_EXACT;
+ }
+ return varTypeQuality;
+ }
}
- if (expr instanceof DartUnqualifiedInvocation) {
- return TypeQuality.INFERRED;
+ if (expr instanceof DartLiteral) {
+ return TypeQuality.INFERRED_EXACT;
}
if (expr instanceof DartUnaryExpression) {
DartUnaryExpression unary = (DartUnaryExpression) expr;
@@ -3592,10 +3600,15 @@ public class TypeAnalyzer implements DartCompilationPhase {
return TypeQuality.INFERRED;
}
if (expr instanceof DartNewExpression) {
+ DartNewExpression newExpression = (DartNewExpression) expr;
+ ConstructorElement constructorElement = newExpression.getElement();
+ if (constructorElement != null && !constructorElement.getModifiers().isFactory()) {
+ return TypeQuality.INFERRED_EXACT;
+ }
return TypeQuality.INFERRED;
}
}
- return TypeQuality.INFERRED_EXACT;
+ return TypeQuality.INFERRED;
}
private static boolean hasTypeBoolIntDouble(DartExpression expr) {
« no previous file with comments | « no previous file | compiler/java/com/google/dart/compiler/type/Types.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698