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

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

Issue 2926613003: Generate better code for '=='. (Closed)
Patch Set: Address comments Created 3 years, 6 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: pkg/dev_compiler/tool/input_sdk/private/ddc_runtime/operations.dart
diff --git a/pkg/dev_compiler/tool/input_sdk/private/ddc_runtime/operations.dart b/pkg/dev_compiler/tool/input_sdk/private/ddc_runtime/operations.dart
index 5e94d58999f4f382716699c9430c09b6b5e0602c..6bacda511799a300a47608e489637d14340bafd7 100644
--- a/pkg/dev_compiler/tool/input_sdk/private/ddc_runtime/operations.dart
+++ b/pkg/dev_compiler/tool/input_sdk/private/ddc_runtime/operations.dart
@@ -548,14 +548,22 @@ check(obj, type) {
return obj;
}
-bool test(obj) {
- if (obj is bool) return obj;
- return booleanConversionFailed(obj);
+bool test(bool obj) {
+ if (obj == null) _throwBooleanConversionError();
+ return obj;
}
-bool booleanConversionFailed(obj) {
- if (obj == null) {
+bool dtest(obj) {
+ if (obj is! bool) booleanConversionFailed(obj);
+ return obj;
+}
+
+void _throwBooleanConversionError() =>
throw new BooleanConversionAssertionError();
+
+void booleanConversionFailed(obj) {
+ if (obj == null) {
+ _throwBooleanConversionError();
}
var actual = getReifiedType(obj);
var expected = JS('', '#', bool);
« no previous file with comments | « pkg/dev_compiler/test/codegen_expected/script.js ('k') | pkg/dev_compiler/tool/input_sdk/private/js_array.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698