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

Unified Diff: pkg/compiler/lib/src/inferrer/simple_types_inferrer.dart

Issue 1276353006: dart2js: Do not use JSDouble for native behavior return types. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Replace use of JS('double') Created 5 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 | sdk/lib/_internal/js_runtime/lib/math_patch.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/inferrer/simple_types_inferrer.dart
diff --git a/pkg/compiler/lib/src/inferrer/simple_types_inferrer.dart b/pkg/compiler/lib/src/inferrer/simple_types_inferrer.dart
index b242c98e140d4a3a58feb1fb02e2585b75769ba2..d394bb7c3dbba41ebd3944c6d0d3442792df9e12 100644
--- a/pkg/compiler/lib/src/inferrer/simple_types_inferrer.dart
+++ b/pkg/compiler/lib/src/inferrer/simple_types_inferrer.dart
@@ -373,9 +373,11 @@ abstract class InferrerEngine<T, V extends TypeSystem>
mappedType = types.stringType;
} else if (type.element == compiler.intClass) {
mappedType = types.intType;
- } else if (type.element == compiler.doubleClass) {
- mappedType = types.doubleType;
- } else if (type.element == compiler.numClass) {
+ } else if (type.element == compiler.numClass ||
+ type.element == compiler.doubleClass) {
+ // Note: the backend double class is specifically for non-integer
+ // doubles, and a native behavior returning 'double' does not guarantee
+ // a non-integer return type, so we return the number type for those.
mappedType = types.numType;
} else if (type.element == compiler.boolClass) {
mappedType = types.boolType;
« no previous file with comments | « no previous file | sdk/lib/_internal/js_runtime/lib/math_patch.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698