[svn] r7606: vs-plugin/trunk:
Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/Project.Refactoring.n
N...
VladD2
svnadmin at nemerle.org
Sun Apr 22 05:51:35 CEST 2007
Log:
1. Fix NullReferenceException in "Find inheritors" implementation.
2. Fix repeated execution of comand in base.ExecCommand().
3. Refactoring.
Author: VladD2
Date: Sun Apr 22 05:51:33 2007
New Revision: 7606
Modified:
vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/Project.Refactoring.n
vs-plugin/trunk/Nemerle.VsIntegration/ (props changed)
vs-plugin/trunk/Nemerle.VsIntegration/LanguageService/NemerleViewFilter.cs
Modified: vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/Project.Refactoring.n
==============================================================================
--- vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/Project.Refactoring.n (original)
+++ vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/Project.Refactoring.n Sun Apr 22 05:51:33 2007
@@ -71,7 +71,7 @@
| Identifier(name) =>
match (activeEnv.LookupType([name], activeBuilder, -1))
{
- | Some(ti) => FindInheritors(ti).ToArray();
+ | Some(ti) => FindInheritors(ti);
| None => array[];
}
| _ => array[]
@@ -422,46 +422,33 @@
chain
}
- private FindInheritors(ofInfo : TypeInfo) : list[GotoInfo]
+ private FindInheritors(ofInfo : TypeInfo) : array[GotoInfo]
{
- mutable result = [];
- def otherBuilders = NamespaceTree.GetTypeBuilders();
+ def result = SCG.List();
def isInheritorOf(possibleInheritor, ourBase)
{
def checkParents(ty)
{
| tb is TypeBuilder =>
- if(tb.BaseType : object == ourBase || tb.InterfacesToImplement().Contains(ourBase))
- true
- else
- {
- def parents = tb.BaseType :: tb.InterfacesToImplement();
- foreach(parent in parents)
- {
- when(isInheritorOf(parent, ourBase))
- return true;
- }
- false
- }
+ tb.BaseType : object == ourBase
+ || tb.InterfacesToImplement().Contains(ourBase)
+ || (tb.BaseType :: tb.InterfacesToImplement())
+ .Exists(isInheritorOf(_, ourBase))
+
| ti : TypeInfo =>
- if(ti.BaseType : object == ourBase)
- true
- else
- {
- when(isInheritorOf(ti.BaseType, ourBase))
- return true;
- false
- }
+ ti.BaseType : object == ourBase || isInheritorOf(ti.BaseType, ourBase)
}
- checkParents(possibleInheritor);
+
+ possibleInheritor != null && checkParents(possibleInheritor);
}
- foreach(builder : TypeBuilder in otherBuilders)
+ foreach(builder : TypeBuilder in NamespaceTree.GetTypeBuilders())
when(!object.ReferenceEquals(builder, ofInfo) && isInheritorOf(builder, ofInfo))
- result ::= GotoInfo(builder.Ast.name.Location);
+ result.Add(builder);
- result
+ result.Sort((x, y) => x.Ast.Name.CompareTo(y.Ast.Name));
+ result.MapToArray(builder => GotoInfo(builder.Ast.name.Location))
}
}
}
\ No newline at end of file
Modified: vs-plugin/trunk/Nemerle.VsIntegration/LanguageService/NemerleViewFilter.cs
==============================================================================
--- vs-plugin/trunk/Nemerle.VsIntegration/LanguageService/NemerleViewFilter.cs (original)
+++ vs-plugin/trunk/Nemerle.VsIntegration/LanguageService/NemerleViewFilter.cs Sun Apr 22 05:51:33 2007
@@ -67,35 +67,38 @@
case 0x3101:
// cmdIdExtendSelection
ExpandSelection();
- break;
+ // it's prevent repeated execution of comand in base.ExecCommand()
+ return VSConstants.S_OK;
case 0x3102:
// cmdIdShrinkSelection
ShrinkSelection();
- break;
+ return VSConstants.S_OK;
case 0x3103: //cmdIdFindInheritors
case 0x3110: //cmdIdFindInheritorsCtxt
FindInheritors();
- break;
+ return VSConstants.S_OK;
case 0x3104: txt = "cmdIdRename"; break;
case 0x3105: txt = "cmdIdInline"; break;
case 0x3106:
// cmdIdOptions
ShowOptions();
- break;
+ return VSConstants.S_OK;
case 0x3107: // AstToolWindow
//this.CodeWindowManager.LanguageService.
NemerleSource source = Source as NemerleSource;
if (source != null)
source.ProjectInfo.ProjectNode.Package.OnAstToolWindowShow(null, null);
- break;
+ return VSConstants.S_OK;
case 0x3108: // cmdIdAddHighlighting
HighlightSymbol();
- break;
+ return VSConstants.S_OK;
case 103: // ESC
case 0x3109: // cmdIdRemoveLastHighlighting
RemoveLastHighlighting();
- break;
+ if (nCmdId == 103) // ESC
+ break; // go trocess ESC
+ return VSConstants.S_OK;
}
if (txt != null)
More information about the svn
mailing list