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

Unified Diff: sdk/lib/_internal/compiler/implementation/ssa/bailout.dart

Issue 12211013: Allow intercepted calls to have typed selectors. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 10 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
Index: sdk/lib/_internal/compiler/implementation/ssa/bailout.dart
===================================================================
--- sdk/lib/_internal/compiler/implementation/ssa/bailout.dart (revision 18164)
+++ sdk/lib/_internal/compiler/implementation/ssa/bailout.dart (working copy)
@@ -112,9 +112,17 @@
if (source != null) {
DartType sourceType = source.computeType(compiler);
DartType speculatedType = speculativeType.computeType(compiler);
- if (speculatedType != null &&
- !compiler.types.isAssignable(speculatedType, sourceType)) {
- return false;
+ JavaScriptBackend backend = compiler.backend;
+ if (speculatedType != null) {
+ // Use the num type instead of JSNumber because JSNumber
+ // is not assignment compatible with int and double, but we
+ // still want to generate a type guard.
+ if (speculatedType.element == backend.jsNumberClass) {
+ speculatedType = compiler.numClass.computeType(compiler);
+ }
+ if (!compiler.types.isAssignable(speculatedType, sourceType)) {
+ return false;
+ }
}
}

Powered by Google App Engine
This is Rietveld 408576698