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

Unified Diff: pkg/dev_compiler/tool/input_sdk/private/ddc_runtime/operations.dart

Issue 2832913003: fix #27971, implement generic function RTTI (Closed)
Patch Set: Created 3 years, 8 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: 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 5299374ca4c7a8c8b2feb2136cd40eca1b1416ac..48194b2c258f80350c5d93a048abc9031099a23c 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
@@ -267,9 +267,12 @@ _checkAndCall(f, ftype, obj, typeArgs, args, name) => JS(
}
// Apply type arguments
- let formalCount = $ftype[$_typeFormalCount];
- if (formalCount != null) {
+ if ($ftype instanceof $GenericFunctionType) {
+ let formalCount = $ftype.formalCount;
+
if ($typeArgs == null) {
+ // TODO(jmesserly): this should use instantiate to bounds logic.
+ // See https://github.com/dart-lang/sdk/issues/27256
$typeArgs = Array(formalCount).fill($dynamic);
} else if ($typeArgs.length != formalCount) {
// TODO(jmesserly): is this the right error?
@@ -278,8 +281,8 @@ _checkAndCall(f, ftype, obj, typeArgs, args, name) => JS(
$typeName($ftype) + ', got <' + $typeArgs + '> expected ' +
formalCount + '.');
}
- // Instantiate the function.
- $ftype = $ftype.apply(null, $typeArgs);
+ // Instantiate the function type.
+ $ftype = $ftype.instantiate($typeArgs);
} else if ($typeArgs != null) {
$throwStrongModeError(
'got type arguments to non-generic function ' + $typeName($ftype) +
@@ -426,7 +429,7 @@ final _ignoreTypeFailure = JS(
if (!!$isSubtype(type, $Iterable) && !!$isSubtype(actual, $Iterable) ||
!!$isSubtype(type, $Future) && !!$isSubtype(actual, $Future) ||
!!$isSubtype(type, $Map) && !!$isSubtype(actual, $Map) ||
- $isFunctionType(type) && $isFunctionType(actual) ||
+ $_isFunctionType(type) && $_isFunctionType(actual) ||
!!$isSubtype(type, $Stream) && !!$isSubtype(actual, $Stream) ||
!!$isSubtype(type, $StreamSubscription) &&
!!$isSubtype(actual, $StreamSubscription)) {

Powered by Google App Engine
This is Rietveld 408576698