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

Unified Diff: pkg/dev_compiler/lib/src/compiler/reify_coercions.dart

Issue 2954523002: fix #27259, implement covariance checking for strong mode and DDC (Closed)
Patch Set: merged and fix an analysis error Created 3 years, 5 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: pkg/dev_compiler/lib/src/compiler/reify_coercions.dart
diff --git a/pkg/dev_compiler/lib/src/compiler/reify_coercions.dart b/pkg/dev_compiler/lib/src/compiler/reify_coercions.dart
index 595d540c30cb8ebf13f2485d91236cd8f93369ea..bf0b57110a7660b8169ae552b718ce7155328234 100644
--- a/pkg/dev_compiler/lib/src/compiler/reify_coercions.dart
+++ b/pkg/dev_compiler/lib/src/compiler/reify_coercions.dart
@@ -32,10 +32,11 @@ class CoercionReifier extends analyzer.GeneralizingAstVisitor<Object> {
return units.map(cr.visitCompilationUnit).toList(growable: false);
}
- /// Returns true if the `as` [node] was created by this class.
+ /// True if the `as` [node] is a required runtime check for soundness.
// TODO(sra): Find a better way to recognize reified coercion, since we
// can't set the isSynthetic attribute.
- static bool isImplicitCast(AsExpression node) => node.asOperator.offset == 0;
+ static bool isRequiredForSoundness(AsExpression node) =>
+ node.asOperator.offset == 0;
/// Creates an implicit cast for expression [e] to [toType].
static Expression castExpression(Expression e, DartType toType) {
@@ -132,9 +133,17 @@ class _TreeCloner extends analyzer.AstCloner {
if (clone is Expression) {
ast_properties.setImplicitCast(
clone, ast_properties.getImplicitCast(node));
+ ast_properties.setImplicitOperationCast(
+ clone, ast_properties.getImplicitOperationCast(node));
ast_properties.setIsDynamicInvoke(
clone, ast_properties.isDynamicInvoke(node));
}
+ if (clone is ClassDeclaration) {
+ ast_properties.setClassCovariantParameters(
+ clone, ast_properties.getClassCovariantParameters(node));
+ ast_properties.setSuperclassCovariantParameters(
+ clone, ast_properties.getSuperclassCovariantParameters(node));
+ }
}
@override
« no previous file with comments | « pkg/dev_compiler/lib/src/compiler/property_model.dart ('k') | pkg/dev_compiler/lib/src/compiler/type_utilities.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698