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

Unified Diff: lib/src/tree.dart

Issue 873313003: Cleanup some ambiguous and incorrect types and disable a case that in analyzer.dart that seems like… (Closed) Base URL: git@github.com:dart-lang/csslib.git@master
Patch Set: ptal Created 5 years, 11 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 | « lib/src/property.dart ('k') | lib/visitor.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/src/tree.dart
diff --git a/lib/src/tree.dart b/lib/src/tree.dart
index 53a5f9f054fd181f337d92e12eeb50d9f27b66c8..37d07414d03235c4346f1cda538d140123696eb2 100644
--- a/lib/src/tree.dart
+++ b/lib/src/tree.dart
@@ -1206,11 +1206,10 @@ class FontExpression extends DartStyleExpression {
lineHeight: lineHeight),
super(DartStyleExpression.fontStyle, span);
- FontExpression merged(FontExpression newFontExpr) {
- if (this.isFont && newFontExpr.isFont) {
+ FontExpression merged(DartStyleExpression newFontExpr) {
+ if (newFontExpr is FontExpression && this.isFont && newFontExpr.isFont) {
return new FontExpression.merge(this, newFontExpr);
}
-
return null;
}
@@ -1222,8 +1221,8 @@ class FontExpression extends DartStyleExpression {
}
FontExpression._merge(FontExpression x, FontExpression y, SourceSpan span)
- : super(DartStyleExpression.fontStyle, span),
- font = new Font.merge(x.font, y.font);
+ : font = new Font.merge(x.font, y.font),
+ super(DartStyleExpression.fontStyle, span);
FontExpression clone() =>
new FontExpression(span, size: font.size, family: font.family,
@@ -1239,13 +1238,6 @@ abstract class BoxExpression extends DartStyleExpression {
BoxExpression(int styleType, SourceSpan span, this.box)
: super(styleType, span);
- /*
- * Merges give 2 DartStyleExpression (or derived from DartStyleExpression,
- * e.g., FontExpression, etc.) will merge if the two expressions are of the
- * same property name (implies same exact type e.g, FontExpression).
- */
- merged(BoxExpression newDartExpr);
-
visit(VisitorBase visitor) => visitor.visitBoxExpression(this);
String get formattedBoxEdge {
@@ -1272,8 +1264,9 @@ class MarginExpression extends BoxExpression {
MarginExpression.boxEdge(SourceSpan span, BoxEdge box)
: super(DartStyleExpression.marginStyle, span, box);
- merged(MarginExpression newMarginExpr) {
- if (this.isMargin && newMarginExpr.isMargin) {
+ merged(DartStyleExpression newMarginExpr) {
+ if (newMarginExpr is MarginExpression && this.isMargin &&
+ newMarginExpr.isMargin) {
return new MarginExpression.merge(this, newMarginExpr);
}
@@ -1307,8 +1300,8 @@ class BorderExpression extends BoxExpression {
BorderExpression.boxEdge(SourceSpan span, BoxEdge box)
: super(DartStyleExpression.borderStyle, span, box);
- merged(BorderExpression newBorderExpr) {
- if (this.isBorder && newBorderExpr.isBorder) {
+ merged(DartStyleExpression newBorderExpr) {
+ if (newBorderExpr is BorderExpression && this.isBorder && newBorderExpr.isBorder) {
return new BorderExpression.merge(this, newBorderExpr);
}
@@ -1340,8 +1333,8 @@ class HeightExpression extends DartStyleExpression {
HeightExpression(SourceSpan span, this.height)
: super(DartStyleExpression.heightStyle, span);
- merged(HeightExpression newHeightExpr) {
- if (this.isHeight && newHeightExpr.isHeight) {
+ merged(DartStyleExpression newHeightExpr) {
+ if (newHeightExpr is DartStyleExpression && this.isHeight && newHeightExpr.isHeight) {
return newHeightExpr;
}
@@ -1358,8 +1351,9 @@ class WidthExpression extends DartStyleExpression {
WidthExpression(SourceSpan span, this.width)
: super(DartStyleExpression.widthStyle, span);
- merged(WidthExpression newWidthExpr) {
- if (this.isWidth && newWidthExpr.isWidth) {
+ merged(DartStyleExpression newWidthExpr) {
+ if (newWidthExpr is WidthExpression && this.isWidth &&
+ newWidthExpr.isWidth) {
return newWidthExpr;
}
@@ -1379,8 +1373,9 @@ class PaddingExpression extends BoxExpression {
PaddingExpression.boxEdge(SourceSpan span, BoxEdge box)
: super(DartStyleExpression.paddingStyle, span, box);
- merged(PaddingExpression newPaddingExpr) {
- if (this.isPadding && newPaddingExpr.isPadding) {
+ merged(DartStyleExpression newPaddingExpr) {
+ if (newPaddingExpr is PaddingExpression && this.isPadding &&
+ newPaddingExpr.isPadding) {
return new PaddingExpression.merge(this, newPaddingExpr);
}
« no previous file with comments | « lib/src/property.dart ('k') | lib/visitor.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698