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

Unified Diff: sdk/lib/_internal/lib/js_rti.dart

Issue 48383003: Support checking of malbounded types. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 2 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/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]

Powered by Google App Engine
This is Rietveld 408576698