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

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

Issue 2996573002: fix #28988, remove throw on Dart1 incompatible is-checks for dartdevc (Closed)
Patch Set: fix changelog Created 3 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 unified diff | Download patch
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 the representation of runtime types. 5 /// This library defines the representation of runtime types.
6 part of dart._runtime; 6 part of dart._runtime;
7 7
8 final metadata = JS('', 'Symbol("metadata")'); 8 final metadata = JS('', 'Symbol("metadata")');
9 9
10 /// The symbol used to store the cached `Type` object associated with a class. 10 /// The symbol used to store the cached `Type` object associated with a class.
(...skipping 1009 matching lines...) Expand 10 before | Expand all | Expand 10 after
1020 } 1020 }
1021 } 1021 }
1022 1022
1023 // We found no definite supertypes, and at least one indefinite supertype 1023 // We found no definite supertypes, and at least one indefinite supertype
1024 // so the answer is indefinite. 1024 // so the answer is indefinite.
1025 if (indefinite) return null; 1025 if (indefinite) return null;
1026 // We found no definite supertypes and no indefinite supertypes, so we 1026 // We found no definite supertypes and no indefinite supertypes, so we
1027 // can return false. 1027 // can return false.
1028 return false; 1028 return false;
1029 })()'''); 1029 })()''');
1030
1031 // TODO(jmesserly): this isn't currently used, but it could be if we want
1032 // `obj is NonGroundType<T,S>` to be rejected at runtime instead of compile
1033 // time.
1034 isGroundType(type) => JS(
1035 '',
1036 '''(() => {
1037 // TODO(vsm): Cache this if we start using it at runtime.
1038
1039 // TODO(jmesserly): implement for generic function types if we start using?
1040 if ($type instanceof $Typedef) $type = $type.functionType;
1041
1042 if ($type instanceof $FunctionType) {
1043 if (!$_isTop($type.returnType)) return false;
1044 for (let i = 0; i < $type.args.length; ++i) {
1045 if (!$_isBottom($type.args[i])) return false;
1046 }
1047 for (let i = 0; i < $type.optionals.length; ++i) {
1048 if (!$_isBottom($type.optionals[i])) return false;
1049 }
1050 let names = $getOwnPropertyNames($type.named);
1051 for (let i = 0; i < names.length; ++i) {
1052 if (!$_isBottom($type.named[names[i]])) return false;
1053 }
1054 return true;
1055 }
1056
1057 let typeArgs = $getGenericArgs($type);
1058 if (!typeArgs) return true;
1059 for (let t of typeArgs) {
1060 if (t != $Object && t != $dynamic) return false;
1061 }
1062 return true;
1063 })()''');
OLDNEW
« no previous file with comments | « pkg/dev_compiler/tool/input_sdk/private/ddc_runtime/runtime.dart ('k') | pkg/dev_compiler/tool/run.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698