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

Unified Diff: lib/src/codegen/reify_coercions.dart

Issue 1059763003: Inference casts to dynamic, fuzzy types handled (Closed) Base URL: git@github.com:dart-lang/dart-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
Index: lib/src/codegen/reify_coercions.dart
diff --git a/lib/src/codegen/reify_coercions.dart b/lib/src/codegen/reify_coercions.dart
index f9165c9bb80df5bf4401dc286f0894e74487e9a5..ce20aeceab08fc439a4af90cef99087ee2bdbd69 100644
--- a/lib/src/codegen/reify_coercions.dart
+++ b/lib/src/codegen/reify_coercions.dart
@@ -39,6 +39,15 @@ class _Inference extends DownwardsInference {
_Inference(TypeRules rules, this._tm) : super(rules);
@override
+ void annotateCastFromDynamic(Expression e, DartType t) {
+ var cast = Coercion.cast(e.staticType, t);
+ var node = new DynamicCast(rules, e, cast);
+ if (!NodeReplacer.replace(e, node)) {
+ _log.severe("Failed to replace node for DownCast");
+ }
+ }
+
+ @override
void annotateListLiteral(ListLiteral e, List<DartType> targs) {
var tNames = targs.map(_tm.typeNameFromDartType).toList();
e.typeArguments = AstBuilder.typeArgumentList(tNames);
@@ -65,6 +74,12 @@ class _Inference extends DownwardsInference {
var rawType = (e.staticType.element as ClassElement).type;
e.staticType = rawType.substitute4(targs);
}
+
+ @override
+ void annotateFunctionExpression(FunctionExpression e, DartType returnType) {
+ // Implicitly changes e.staticType
+ (e.element as ExecutableElementImpl).returnType = returnType;
+ }
}
// This class implements a pass which modifies (in place) the ast replacing

Powered by Google App Engine
This is Rietveld 408576698