Index: sdk/lib/_internal/compiler/implementation/inferrer/type_graph_inferrer.dart |
=================================================================== |
--- sdk/lib/_internal/compiler/implementation/inferrer/type_graph_inferrer.dart (revision 30666) |
+++ sdk/lib/_internal/compiler/implementation/inferrer/type_graph_inferrer.dart (working copy) |
@@ -78,6 +78,18 @@ |
return intTypeCache = getConcreteTypeFor(compiler.typesTask.intType); |
} |
+ TypeInformation uint32TypeCache; |
+ TypeInformation get uint32Type { |
+ if (uint32TypeCache != null) return uint32TypeCache; |
+ return uint32TypeCache = getConcreteTypeFor(compiler.typesTask.uint32Type); |
+ } |
+ |
+ TypeInformation uint31TypeCache; |
+ TypeInformation get uint31Type { |
+ if (uint31TypeCache != null) return uint31TypeCache; |
+ return uint31TypeCache = getConcreteTypeFor(compiler.typesTask.uint31Type); |
+ } |
+ |
TypeInformation doubleTypeCache; |
TypeInformation get doubleType { |
if (doubleTypeCache != null) return doubleTypeCache; |
@@ -225,6 +237,7 @@ |
} |
ConcreteTypeInformation getConcreteTypeFor(TypeMask mask) { |
+ assert(mask != null); |
return concreteTypes.putIfAbsent(mask, () { |
return new ConcreteTypeInformation(mask); |
}); |
@@ -491,6 +504,15 @@ |
// If [element] is final and has an initializer, we record |
// the inferred type. |
if (node.asSendSet() != null) { |
+ if (type is! ContainerTypeInformation) { |
+ // For non-container types, the constant handler does |
+ // constant folding that could give more precise results. |
+ var value = |
kasperl
2013/11/26 14:58:40
What's the type of this?
ngeoffray
2013/11/26 15:19:12
Constant. I need to add a 'show' to type it. Done.
|
+ compiler.constantHandler.getConstantForVariable(element); |
+ if (value != null) { |
+ type = types.getConcreteTypeFor(value.computeMask(compiler)); |
+ } |
+ } |
recordType(element, type); |
} else if (!element.isInstanceMember()) { |
recordType(element, types.nullType); |