Chromium Code Reviews| 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 835ead6f55a006461877ef6cb31680a4c128fc5c..d8014d99ed6feb7339dd88c153a6a3d89553b003 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 |
| @@ -701,11 +701,20 @@ map(values, [K, V]) => JS( |
| })()'''); |
| @JSExportName('assert') |
| -assert_(condition, [message]) => JS( |
| - '', |
| - '''(() => { |
| - if (!$condition) $throwAssertionError(message); |
| -})()'''); |
| +assert_(condition, message()) { |
| + if (JS('bool', '# !== true', condition)) { |
| + if (condition == null) _throwBooleanConversionError(); |
|
Jennifer Messerly
2017/07/07 23:43:17
Now has correct handling for null
|
| + throwAssertionError(message); |
| + } |
| +} |
| + |
| +dassert(value, message()) { |
| + if (JS('bool', '# != null && #[#] instanceof #', value, value, _runtimeType, |
| + AbstractFunctionType)) { |
| + value = JS('', '#(#)', dcall, value); |
| + } |
| + return assert_(dtest(value), message); |
|
Jennifer Messerly
2017/07/07 23:43:17
now correctly handles all cases where a non-boolea
|
| +} |
| /// Store a JS error for an exception. For non-primitives, we store as an |
| /// expando. For primitive, we use a side cache. To limit memory leakage, we |