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

Unified Diff: tool/input_sdk/private/ddc_runtime/operations.dart

Issue 2007423003: Short circuit for 'as dynamic' (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: Created 4 years, 7 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_sdk.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tool/input_sdk/private/ddc_runtime/operations.dart
diff --git a/tool/input_sdk/private/ddc_runtime/operations.dart b/tool/input_sdk/private/ddc_runtime/operations.dart
index 9f14816f5d2d1966a8eeec78930087a2a290b1ca..92f62e2ba2a968c8ec46fb76989d01db13f42f22 100644
--- a/tool/input_sdk/private/ddc_runtime/operations.dart
+++ b/tool/input_sdk/private/ddc_runtime/operations.dart
@@ -253,8 +253,7 @@ instanceOf(obj, type) => JS('', '''(() => {
@JSExportName('as')
cast(obj, type) {
- if (obj == null) return obj;
-
+ if (JS('bool', '# == #', type, dynamic) || obj == null) return obj;
Jennifer Messerly 2016/05/26 18:14:51 super trivial but: wouldn't null be more common th
Leaf 2016/05/26 18:16:37 Maybe, but I doubt it. By far the majority of the
bool result = strongInstanceOf(obj, type, true);
if (JS('bool', '#', result)) return obj;
_throwCastError(obj, type, result);
« no previous file with comments | « lib/runtime/dart_sdk.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698