Skip to content

Commit

Permalink
Allow += in prefer_interpolation_to_compose_strings (#813). (#831)
Browse files Browse the repository at this point in the history
Fixes: #813
  • Loading branch information
pq committed Nov 1, 2017
1 parent cd13719 commit caf2e34
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 16 deletions.
15 changes: 0 additions & 15 deletions lib/src/rules/prefer_interpolation_to_compose_strings.dart
Original file line number Diff line number Diff line change
Expand Up @@ -47,21 +47,6 @@ class _Visitor extends SimpleAstVisitor {

_Visitor(this.rule);

@override
visitAssignmentExpression(AssignmentExpression node) {
if (skippedNodes.contains(node)) {
return;
}
if (node.operator.type == TokenType.PLUS_EQ &&
(DartTypeUtilities.isClass(
node.leftHandSide.bestType, 'String', 'dart.core') ||
DartTypeUtilities.isClass(
node.rightHandSide.bestType, 'String', 'dart.core'))) {
DartTypeUtilities.traverseNodesInDFS(node).forEach(skippedNodes.add);
rule.reportLint(node);
}
}

@override
visitBinaryExpression(BinaryExpression node) {
if (skippedNodes.contains(node)) {
Expand Down
2 changes: 1 addition & 1 deletion test/rules/prefer_interpolation_to_compose_strings.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ void main() {
'! You are ' +
(year - birth).toString() +
' years old.';
name += 'casanueva'; // LINT
name += 'casanueva'; // OK (#813)

int width = 10;
String pad = '';
Expand Down

0 comments on commit caf2e34

Please sign in to comment.