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

Unified Diff: sdk/lib/_internal/compiler/implementation/js_backend/runtime_types.dart

Issue 22903036: Use predicates to check simple function types. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Updated cf. comments. Created 7 years, 4 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/compiler/implementation/js_backend/runtime_types.dart
diff --git a/sdk/lib/_internal/compiler/implementation/js_backend/runtime_types.dart b/sdk/lib/_internal/compiler/implementation/js_backend/runtime_types.dart
index 29e1ecba526e5e4e8c4f79a4438fdf5e2cb4ab2f..9308becabd06b2db80a661a694cacfc327fa2637 100644
--- a/sdk/lib/_internal/compiler/implementation/js_backend/runtime_types.dart
+++ b/sdk/lib/_internal/compiler/implementation/js_backend/runtime_types.dart
@@ -545,6 +545,18 @@ class RuntimeTypes {
return representationGenerator.getTypeRepresentation(type, onVariable);
}
+ bool isSimpleFunctionType(FunctionType type) {
+ if (!type.returnType.isDynamic) return false;
+ if (!type.optionalParameterTypes.isEmpty) return false;
+ if (!type.namedParameterTypes.isEmpty) return false;
+ for (Link<DartType> link = type.parameterTypes;
+ !link.isEmpty;
+ link = link.tail) {
+ if (!link.head.isDynamic) return false;
+ }
+ return true;
+ }
+
static bool hasTypeArguments(DartType type) {
if (type is InterfaceType) {
InterfaceType interfaceType = type;

Powered by Google App Engine
This is Rietveld 408576698