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

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

Issue 2788933002: Fix ignore on FutureOr (Closed)
Patch Set: Reformat 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 unified diff | Download patch
« no previous file with comments | « pkg/dev_compiler/lib/sdk/ddc_sdk.sum ('k') | pkg/dev_compiler/tool/sdk_expected_errors.txt » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 /// This library defines runtime operations on objects used by the code 5 /// This library defines runtime operations on objects used by the code
6 /// generator. 6 /// generator.
7 part of dart._runtime; 7 part of dart._runtime;
8 8
9 class InvocationImpl extends Invocation { 9 class InvocationImpl extends Invocation {
10 final Symbol memberName; 10 final Symbol memberName;
(...skipping 452 matching lines...) Expand 10 before | Expand all | Expand 10 after
463 }; 463 };
464 })()'''); 464 })()''');
465 465
466 final _ignoreTypeFailure = JS( 466 final _ignoreTypeFailure = JS(
467 '', 467 '',
468 '''(() => { 468 '''(() => {
469 return $_ignoreMemo((actual, type) => { 469 return $_ignoreMemo((actual, type) => {
470 // TODO(vsm): Remove this hack ... 470 // TODO(vsm): Remove this hack ...
471 // This is primarily due to the lack of generic methods, 471 // This is primarily due to the lack of generic methods,
472 // but we need to triage all the types. 472 // but we need to triage all the types.
473 if ($_isFutureOr(type)) {
474 // Ignore if we would ignore either side of union.
475 let typeArg = $getGenericArgs(type)[0];
476 let typeFuture = ${getGenericClass(Future)}(typeArg);
477 return $_ignoreTypeFailure(actual, typeFuture) ||
478 $_ignoreTypeFailure(actual, typeArg);
479 }
480
473 if (!!$isSubtype(type, $Iterable) && !!$isSubtype(actual, $Iterable) || 481 if (!!$isSubtype(type, $Iterable) && !!$isSubtype(actual, $Iterable) ||
474 !!$isSubtype(type, $FutureOr) && !!$isSubtype(actual, $Future) || 482 !!$isSubtype(type, $Future) && !!$isSubtype(actual, $Future) ||
475 !!$isSubtype(type, $Map) && !!$isSubtype(actual, $Map) || 483 !!$isSubtype(type, $Map) && !!$isSubtype(actual, $Map) ||
476 $isFunctionType(type) && $isFunctionType(actual) || 484 $isFunctionType(type) && $isFunctionType(actual) ||
477 !!$isSubtype(type, $Stream) && !!$isSubtype(actual, $Stream) || 485 !!$isSubtype(type, $Stream) && !!$isSubtype(actual, $Stream) ||
478 !!$isSubtype(type, $StreamSubscription) && 486 !!$isSubtype(type, $StreamSubscription) &&
479 !!$isSubtype(actual, $StreamSubscription)) { 487 !!$isSubtype(actual, $StreamSubscription)) {
480 console.warn('Ignoring cast fail from ' + $typeName(actual) + 488 console.warn('Ignoring cast fail from ' + $typeName(actual) +
481 ' to ' + $typeName(type)); 489 ' to ' + $typeName(type));
482 return true; 490 return true;
483 } 491 }
484 return false; 492 return false;
(...skipping 490 matching lines...) Expand 10 before | Expand all | Expand 10 after
975 name = '+' + name; 983 name = '+' + name;
976 } 984 }
977 return name; 985 return name;
978 } 986 }
979 987
980 /// Emulates the implicit "loadLibrary" function provided by a deferred library. 988 /// Emulates the implicit "loadLibrary" function provided by a deferred library.
981 /// 989 ///
982 /// Libraries are not actually deferred in DDC, so this just returns a future 990 /// Libraries are not actually deferred in DDC, so this just returns a future
983 /// that completes immediately. 991 /// that completes immediately.
984 Future loadLibrary() => new Future.value(); 992 Future loadLibrary() => new Future.value();
OLDNEW
« no previous file with comments | « pkg/dev_compiler/lib/sdk/ddc_sdk.sum ('k') | pkg/dev_compiler/tool/sdk_expected_errors.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698