Skip to content

Commit

Permalink
fix ResolutionCopier.visitAdjacentStrings
Browse files Browse the repository at this point in the history
  • Loading branch information
John Messerly committed Mar 2, 2016
1 parent f12b2ed commit 1226c38
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
7 changes: 6 additions & 1 deletion pkg/analyzer/lib/src/generated/parser.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9956,7 +9956,12 @@ class ResolutionCopier implements AstVisitor<bool> {
@override
bool visitAdjacentStrings(AdjacentStrings node) {
AdjacentStrings toNode = this._toNode as AdjacentStrings;
return _isEqualNodeLists(node.strings, toNode.strings);
if (_isEqualNodeLists(node.strings, toNode.strings)) {
toNode.staticType = node.staticType;
toNode.propagatedType = node.propagatedType;
return true;
}
return false;
}

@override
Expand Down
18 changes: 18 additions & 0 deletions pkg/analyzer/test/generated/parser_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4249,6 +4249,24 @@ class C {

@reflectiveTest
class ResolutionCopierTest extends EngineTestCase {
void test_visitAdjacentStrings() {
AdjacentStrings createNode() => new AdjacentStrings([
new SimpleStringLiteral(null, 'hello'),
new SimpleStringLiteral(null, 'world')
]);

AdjacentStrings fromNode = createNode();
DartType propagatedType = ElementFactory.classElement2("A").type;
fromNode.propagatedType = propagatedType;
DartType staticType = ElementFactory.classElement2("B").type;
fromNode.staticType = staticType;

AdjacentStrings toNode = createNode();
ResolutionCopier.copyResolutionData(fromNode, toNode);
expect(toNode.propagatedType, same(propagatedType));
expect(toNode.staticType, same(staticType));
}

void test_visitAnnotation() {
String annotationName = "proxy";
Annotation fromNode =
Expand Down

0 comments on commit 1226c38

Please sign in to comment.