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

Unified Diff: lib/src/checker/rules.dart

Issue 1348453004: fix some errors in our SDK, mostly around numbers (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: Created 5 years, 3 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 | « lib/runtime/dart_runtime.js ('k') | lib/src/codegen/js_codegen.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/src/checker/rules.dart
diff --git a/lib/src/checker/rules.dart b/lib/src/checker/rules.dart
index 279a82bcb0dceb58c01a002eefdae32079b3bce3..b32163dbbfce94d76aa1ddda4f0af4d81d23c016 100644
--- a/lib/src/checker/rules.dart
+++ b/lib/src/checker/rules.dart
@@ -37,7 +37,16 @@ abstract class TypeRules {
bool isBoolType(DartType t) => t == provider.boolType;
bool isDoubleType(DartType t) => t == provider.doubleType;
bool isIntType(DartType t) => t == provider.intType;
- bool isNumType(DartType t) => t == provider.intType.superclass;
+ bool isNumType(DartType t) => t == provider.numType;
+
+ /// Returns true if this is any kind of object represented by `Number` in JS.
+ ///
+ /// In practice, this is 4 types: num, int, double, and JSNumber.
+ ///
+ /// JSNumber is the type that actually "implements" all numbers, hence it's
+ /// a subtype of int and double (and num). It's in our "dart:_interceptors".
+ bool isNumberInJS(DartType t) => isSubTypeOf(t, provider.numType);
+
bool isStringType(DartType t) => t == provider.stringType;
bool isNonNullableType(DartType t) => false;
bool maybeNonNullableType(DartType t) => false;
« no previous file with comments | « lib/runtime/dart_runtime.js ('k') | lib/src/codegen/js_codegen.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698