mirror of
https://github.com/dart-lang/sdk
synced 2024-10-14 11:31:57 +00:00
Add back missing cast failure cache on function types.
Casts for function types got moved off of the generic path, and hence are missing the memo cache. Added a second function type cast cache. Fixes #31392 Bug: Change-Id: Ie1b87adf630f5059b57d01956778f5adde0533fc Reviewed-on: https://dart-review.googlesource.com/21525 Reviewed-by: Vijay Menon <vsm@google.com>
This commit is contained in:
parent
92ebd8aefa
commit
4a56f7b360
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Binary file not shown.
|
@ -428,6 +428,13 @@ class FunctionType extends AbstractFunctionType {
|
|||
return false;
|
||||
}
|
||||
|
||||
static final void Function(Object, Object) _logIgnoredCast =
|
||||
JS('', '''(() => $_ignoreMemo((actual, expected) => {
|
||||
console.warn('Ignoring cast fail from ' + $typeName(actual) +
|
||||
' to ' + $typeName(expected));
|
||||
return null;
|
||||
}))()''');
|
||||
|
||||
@JSExportName('as')
|
||||
as_T(obj, [bool typeError]) {
|
||||
if (obj == null) return obj;
|
||||
|
@ -439,8 +446,7 @@ class FunctionType extends AbstractFunctionType {
|
|||
var result = isSubtype(actual, this);
|
||||
if (result == true) return obj;
|
||||
if (result == null && JS('bool', 'dart.__ignoreWhitelistedErrors')) {
|
||||
JS('', "console.warn(#)",
|
||||
'Ignoring cast fail from ${typeName(actual)} to ${typeName(this)}');
|
||||
_logIgnoredCast(actual, this);
|
||||
return obj;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue