Index: sdk/lib/_internal/js_runtime/lib/js_helper.dart |
diff --git a/sdk/lib/_internal/js_runtime/lib/js_helper.dart b/sdk/lib/_internal/js_runtime/lib/js_helper.dart |
index 86e80d81b6ddbed5229a0da8d4540ac24cdd27c3..34fddfb13f8c020401a2752e85b27bf76fd3741a 100644 |
--- a/sdk/lib/_internal/js_runtime/lib/js_helper.dart |
+++ b/sdk/lib/_internal/js_runtime/lib/js_helper.dart |
@@ -163,6 +163,15 @@ bool isNullType(Object type) { |
JS_GET_NAME(JsGetName.NULL_CLASS_TYPE_NAME)); |
} |
+/// Returns true if the given [type] is the `void` type. |
+@ForceInline() |
+bool isVoidType(Object type) { |
+ return JS_BUILTIN('returns:bool;effects:none;depends:none', |
+ JsBuiltin.isGivenTypeRti, |
+ type, |
+ JS_GET_NAME(JsGetName.VOID_CLASS_TYPE_NAME)); |
+} |
+ |
/// Returns whether the given type is _the_ Dart Object type. |
// TODO(floitsch): move this to foreign_helper.dart or similar. |
@ForceInline() |
@@ -183,6 +192,16 @@ bool isNullTypeRti(type) { |
JS_GET_NAME(JsGetName.NULL_CLASS_TYPE_NAME)); |
} |
+/// Returns whether the given type is void type. |
+// TODO(floitsch): move this to foreign_helper.dart or similar. |
+@ForceInline() |
+bool isVoidTypeRti(type) { |
+ return JS_BUILTIN('returns:bool;effects:none;depends:none', |
+ JsBuiltin.isGivenTypeRti, |
+ type, |
+ JS_GET_NAME(JsGetName.VOID_CLASS_TYPE_NAME)); |
+} |
+ |
/// Returns the metadata of the given [index]. |
// TODO(floitsch): move this to foreign_helper.dart or similar. |
@ForceInline() |
@@ -3698,11 +3717,14 @@ RuntimeType getDynamicRuntimeType() => const DynamicRuntimeType(); |
class VoidRuntimeType extends RuntimeType { |
const VoidRuntimeType(); |
- String toString() => 'void'; |
+ String toString() => (new Void().runtimeType).toString(); // 'void'; |
toRti() => throw 'internal error'; |
} |
+/// The internal class representing `void`. |
+class Void {} |
+ |
RuntimeType getVoidRuntimeType() => const VoidRuntimeType(); |
/** |