Skip to content

Commit

Permalink
Redo letter signature adjustment
Browse files Browse the repository at this point in the history
  • Loading branch information
Hosch250 committed May 18, 2015
1 parent f712225 commit 55c6d44
Showing 1 changed file with 11 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -105,12 +105,6 @@ private void AdjustReferences()
}
catch
{
// update letter methods - needs proper fixing
if (reference.Context.Parent.GetText().Contains("Property Let"))
{
AdjustSignature(reference);
}

continue;
}

Expand Down Expand Up @@ -169,7 +163,7 @@ private void AdjustSignature()
var argList = (VBAParser.ArgListContext)proc.argList();
var module = _view.Target.QualifiedName.QualifiedModuleName.Component.CodeModule;

// if we are reordering a property getter, check if we need to reorder a setter too
// if we are reordering a property getter, check if we need to reorder a letter/setter too
if (_view.Target.DeclarationType == DeclarationType.PropertyGet)
{
var setter = _declarations.Items.FirstOrDefault(item => item.ParentScope == _view.Target.ParentScope &&
Expand All @@ -180,6 +174,15 @@ private void AdjustSignature()
{
AdjustSignature(setter);
}

var letter = _declarations.Items.FirstOrDefault(item => item.ParentScope == _view.Target.ParentScope &&
item.IdentifierName == _view.Target.IdentifierName &&
item.DeclarationType == DeclarationType.PropertyLet);

if (letter != null)
{
AdjustSignature(letter);
}
}

RewriteSignature(argList, module);
Expand All @@ -200,7 +203,7 @@ private void AdjustSignature(Declaration reference)
var module = reference.QualifiedName.QualifiedModuleName.Component.CodeModule;
VBAParser.ArgListContext argList;

if (reference.DeclarationType == DeclarationType.PropertySet)
if (reference.DeclarationType == DeclarationType.PropertySet || reference.DeclarationType == DeclarationType.PropertyLet)
{
argList = (VBAParser.ArgListContext)proc.children[0].argList();
}
Expand Down

0 comments on commit 55c6d44

Please sign in to comment.