Fix incremental parsing when class name is changed.
This bug was discovered by the incremental parse stress tester. R=brianwilkerson@google.com Review URL: https://codereview.chromium.org//760863002 git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@42000 260f80e4-7a28-3924-810f-c04153c831b5
This commit is contained in:
@@ -842,7 +842,9 @@ class IncrementalParseDispatcher implements AstVisitor<AstNode> {
|
||||
} else if (node.metadata.contains(_oldNode)) {
|
||||
return _parser.parseAnnotation();
|
||||
} else if (identical(_oldNode, node.name)) {
|
||||
return _parser.parseSimpleIdentifier();
|
||||
// Changing the class name changes whether a member is interpreted as a
|
||||
// constructor or not, so we'll just have to re-parse the entire class.
|
||||
throw new InsufficientContextException();
|
||||
} else if (identical(_oldNode, node.typeParameters)) {
|
||||
return _parser.parseTypeParameterList();
|
||||
} else if (identical(_oldNode, node.extendsClause)) {
|
||||
|
||||
@@ -2712,6 +2712,12 @@ class IncrementalParserTest extends EngineTestCase {
|
||||
_assertParse("f() => a", "", " ", " + b;");
|
||||
}
|
||||
|
||||
void test_rename_class_withConstructor() {
|
||||
// "class C { C() {} }"
|
||||
// "class D { C() {} }"
|
||||
_assertParse('class ', 'C', 'D', ' { C() {} }');
|
||||
}
|
||||
|
||||
void test_replace_field_type_with_void() {
|
||||
// Note: this produces an error, but we still need the parser to produce a
|
||||
// consistent parse tree for it.
|
||||
|
||||
Reference in New Issue
Block a user