Chromium Code Reviews| Index: sdk/lib/_internal/lib/js_rti.dart |
| diff --git a/sdk/lib/_internal/lib/js_rti.dart b/sdk/lib/_internal/lib/js_rti.dart |
| index aea2fc30d2ab498754937cc20582f9bba5d7ad6f..3670841aceae25c64c2b83742af235db742ae9ec 100644 |
| --- a/sdk/lib/_internal/lib/js_rti.dart |
| +++ b/sdk/lib/_internal/lib/js_rti.dart |
| @@ -286,6 +286,18 @@ Object assertSubtype(Object object, String isField, List checks, |
| return object; |
| } |
| +/// Checks that the type represented by [subtype] is a subtype of [supertype]. |
| +/// If not a type error with [message] is thrown. |
| +assertIsSubtype(var subtype, var supertype, String message) { |
|
karlklose
2013/10/30 09:47:43
It is a bit unfortunate that this name is so simil
|
| + if (!isSubtype(subtype, supertype)) { |
| + throwTypeError(message); |
| + } |
| +} |
| + |
| +throwTypeError(message) { |
| + throw new TypeErrorImplementation.fromMessage(message); |
| +} |
| + |
| /** |
| * Check that the types in the list [arguments] are subtypes of the types in |
| * list [checks] (at the respective positions), possibly applying [substitution] |