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

Unified Diff: lib/src/checker/rules.dart

Issue 1038583004: Rationalize coercions (Closed) Base URL: https://github.com/dart-lang/dev_compiler.git@master
Patch Set: Created 5 years, 9 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
« no previous file with comments | « no previous file | lib/src/codegen/reify_coercions.dart » ('j') | lib/src/info.dart » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/src/checker/rules.dart
diff --git a/lib/src/checker/rules.dart b/lib/src/checker/rules.dart
index cbca57a9335351247d3f6e9902e1741d584e2c4e..3db1e643f96a4764feebbec2d49d8d227200d512 100644
--- a/lib/src/checker/rules.dart
+++ b/lib/src/checker/rules.dart
@@ -393,7 +393,7 @@ class RestrictedRules extends TypeRules {
final n2s = toT.namedParameterTypes;
final ret2 = toT.returnType;
- Coercion ret = _coerceTo(ret1, ret2, true);
+ Coercion ret = _coerceTo(ret1, ret2, options.wrapClosures);
// Reject if one has named and the other has optional
if (n1s.length > 0 && o2s.length > 0) return Coercion.error();
@@ -456,6 +456,7 @@ class RestrictedRules extends TypeRules {
// fromT <: toT, no coercion needed
if (isSubTypeOf(fromT, toT)) return Coercion.identity(toT);
+ // FIXME(vsm): I don't think we need this any more.
Leaf 2015/03/25 21:06:28 Why not?
// Downcasting from dynamic to object always succeeds,
// no coercion needed.
if (fromT.isDynamic && toT == provider.objectType) {
@@ -494,7 +495,7 @@ class RestrictedRules extends TypeRules {
StaticInfo checkAssignment(Expression expr, DartType toT, bool constContext) {
final fromT = getStaticType(expr);
- final Coercion c = _coerceTo(fromT, toT, true);
+ final Coercion c = _coerceTo(fromT, toT, options.wrapClosures);
if (c is Identity) return null;
if (c is CoercionError) return new StaticTypeError(this, expr, toT);
if (constContext && !options.allowConstCasts) {
« no previous file with comments | « no previous file | lib/src/codegen/reify_coercions.dart » ('j') | lib/src/info.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698