Browse Source

Fix NRE in IntroduceExtensionMethods: We have to skip members without symbol information.

pull/835/merge
Siegfried Pammer 8 years ago
parent
commit
769e66aa14
  1. 7
      ICSharpCode.Decompiler/CSharp/Transforms/IntroduceExtensionMethods.cs

7
ICSharpCode.Decompiler/CSharp/Transforms/IntroduceExtensionMethods.cs

@ -58,6 +58,7 @@ namespace ICSharpCode.Decompiler.CSharp.Transforms
public override void VisitMethodDeclaration(MethodDeclaration methodDeclaration) public override void VisitMethodDeclaration(MethodDeclaration methodDeclaration)
{ {
currentMember = methodDeclaration.GetSymbol() as IMember; currentMember = methodDeclaration.GetSymbol() as IMember;
if (currentMember == null) return;
SetContext(); SetContext();
base.VisitMethodDeclaration(methodDeclaration); base.VisitMethodDeclaration(methodDeclaration);
currentMember = null; currentMember = null;
@ -66,6 +67,7 @@ namespace ICSharpCode.Decompiler.CSharp.Transforms
public override void VisitConstructorDeclaration(ConstructorDeclaration constructorDeclaration) public override void VisitConstructorDeclaration(ConstructorDeclaration constructorDeclaration)
{ {
currentMember = constructorDeclaration.GetSymbol() as IMember; currentMember = constructorDeclaration.GetSymbol() as IMember;
if (currentMember == null) return;
SetContext(); SetContext();
base.VisitConstructorDeclaration(constructorDeclaration); base.VisitConstructorDeclaration(constructorDeclaration);
currentMember = null; currentMember = null;
@ -74,6 +76,7 @@ namespace ICSharpCode.Decompiler.CSharp.Transforms
public override void VisitDestructorDeclaration(DestructorDeclaration destructorDeclaration) public override void VisitDestructorDeclaration(DestructorDeclaration destructorDeclaration)
{ {
currentMember = destructorDeclaration.GetSymbol() as IMember; currentMember = destructorDeclaration.GetSymbol() as IMember;
if (currentMember == null) return;
SetContext(); SetContext();
base.VisitDestructorDeclaration(destructorDeclaration); base.VisitDestructorDeclaration(destructorDeclaration);
currentMember = null; currentMember = null;
@ -82,6 +85,7 @@ namespace ICSharpCode.Decompiler.CSharp.Transforms
public override void VisitPropertyDeclaration(PropertyDeclaration propertyDeclaration) public override void VisitPropertyDeclaration(PropertyDeclaration propertyDeclaration)
{ {
currentMember = propertyDeclaration.GetSymbol() as IMember; currentMember = propertyDeclaration.GetSymbol() as IMember;
if (currentMember == null) return;
SetContext(); SetContext();
base.VisitPropertyDeclaration(propertyDeclaration); base.VisitPropertyDeclaration(propertyDeclaration);
currentMember = null; currentMember = null;
@ -90,6 +94,7 @@ namespace ICSharpCode.Decompiler.CSharp.Transforms
public override void VisitFieldDeclaration(FieldDeclaration fieldDeclaration) public override void VisitFieldDeclaration(FieldDeclaration fieldDeclaration)
{ {
currentMember = fieldDeclaration.GetSymbol() as IMember; currentMember = fieldDeclaration.GetSymbol() as IMember;
if (currentMember == null) return;
SetContext(); SetContext();
base.VisitFieldDeclaration(fieldDeclaration); base.VisitFieldDeclaration(fieldDeclaration);
currentMember = null; currentMember = null;
@ -98,6 +103,7 @@ namespace ICSharpCode.Decompiler.CSharp.Transforms
public override void VisitEventDeclaration(EventDeclaration eventDeclaration) public override void VisitEventDeclaration(EventDeclaration eventDeclaration)
{ {
currentMember = eventDeclaration.GetSymbol() as IMember; currentMember = eventDeclaration.GetSymbol() as IMember;
if (currentMember == null) return;
SetContext(); SetContext();
base.VisitEventDeclaration(eventDeclaration); base.VisitEventDeclaration(eventDeclaration);
currentMember = null; currentMember = null;
@ -106,6 +112,7 @@ namespace ICSharpCode.Decompiler.CSharp.Transforms
public override void VisitCustomEventDeclaration(CustomEventDeclaration eventDeclaration) public override void VisitCustomEventDeclaration(CustomEventDeclaration eventDeclaration)
{ {
currentMember = eventDeclaration.GetSymbol() as IMember; currentMember = eventDeclaration.GetSymbol() as IMember;
if (currentMember == null) return;
SetContext(); SetContext();
base.VisitCustomEventDeclaration(eventDeclaration); base.VisitCustomEventDeclaration(eventDeclaration);
currentMember = null; currentMember = null;

Loading…
Cancel
Save