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

Unified Diff: sdk/lib/_internal/compiler/implementation/constants.dart

Issue 94303002: Add another type JSPositiveInt to show a range analysis in the inferrer would be very beneficial :-… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 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
Index: sdk/lib/_internal/compiler/implementation/constants.dart
===================================================================
--- sdk/lib/_internal/compiler/implementation/constants.dart (revision 30754)
+++ sdk/lib/_internal/compiler/implementation/constants.dart (working copy)
@@ -164,6 +164,7 @@
bool isInt() => true;
bool isUInt31() => value >= 0 && value < (1 << 31);
bool isUInt32() => value >= 0 && value < (1 << 32);
+ bool isPositive() => value >= 0;
DartType computeType(Compiler compiler) {
return compiler.intClass.computeType(compiler);
@@ -172,6 +173,7 @@
ti.TypeMask computeMask(Compiler compiler) {
if (isUInt31()) return compiler.typesTask.uint31Type;
if (isUInt32()) return compiler.typesTask.uint32Type;
+ if (isPositive()) return compiler.typesTask.positiveIntType;
return compiler.typesTask.intType;
}

Powered by Google App Engine
This is Rietveld 408576698