mirror of
https://github.com/dart-lang/sdk
synced 2024-11-02 12:24:24 +00:00
Check that target of a new constructor is a ClassDeclaration.
For an exception #10 from the list. Cannot reproduce though. R=brianwilkerson@google.com BUG= Review URL: https://codereview.chromium.org/1757393002 .
This commit is contained in:
parent
1cc5dab2f2
commit
6510065262
1 changed files with 14 additions and 6 deletions
|
@ -700,10 +700,14 @@ class FixProcessor {
|
|||
return;
|
||||
}
|
||||
ClassElement targetElement = constructorElement.enclosingElement;
|
||||
String targetFile = targetElement.source.fullName;
|
||||
ClassDeclaration targetClass = getParsedClassElementNode(targetElement);
|
||||
// prepare location for a new constructor
|
||||
AstNode targetTypeNode = getParsedClassElementNode(targetElement);
|
||||
if (targetTypeNode is! ClassDeclaration) {
|
||||
return;
|
||||
}
|
||||
_ConstructorLocation targetLocation =
|
||||
_prepareNewConstructorLocation(targetClass);
|
||||
_prepareNewConstructorLocation(targetTypeNode);
|
||||
String targetFile = targetElement.source.fullName;
|
||||
// build method source
|
||||
SourceBuilder sb = new SourceBuilder(targetFile, targetLocation.offset);
|
||||
{
|
||||
|
@ -753,11 +757,15 @@ class FixProcessor {
|
|||
if (targetType is! InterfaceType) {
|
||||
return;
|
||||
}
|
||||
// prepare location for a new constructor
|
||||
ClassElement targetElement = targetType.element as ClassElement;
|
||||
String targetFile = targetElement.source.fullName;
|
||||
ClassDeclaration targetClass = getParsedClassElementNode(targetElement);
|
||||
AstNode targetTypeNode = getParsedClassElementNode(targetElement);
|
||||
if (targetTypeNode is! ClassDeclaration) {
|
||||
return;
|
||||
}
|
||||
_ConstructorLocation targetLocation =
|
||||
_prepareNewConstructorLocation(targetClass);
|
||||
_prepareNewConstructorLocation(targetTypeNode);
|
||||
String targetFile = targetElement.source.fullName;
|
||||
// build method source
|
||||
SourceBuilder sb = new SourceBuilder(targetFile, targetLocation.offset);
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue