[svn] r7300: vs-plugin/trunk: Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/Checker.n Nemerle.Compi...

IT svnadmin at nemerle.org
Sat Jan 20 01:39:42 CET 2007


Log:
1. Fixed the using of private variable.
2. Hide direct use of _engine.
3. Some refactoring.

Author: IT
Date: Sat Jan 20 01:39:30 2007
New Revision: 7300

Modified:
   vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/Checker.n
   vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/CompileUnitCollection.n
   vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/Formatter.n
   vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/Project.Refactoring.n
   vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/Project.Relocation.n
   vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/Project.Type.n
   vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/Project.n
   vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/QuickTipInfo.n
   vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/DefineCollection.n
   vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/ReferenceCollection.n
   vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/SourceCollection.n
   vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/Tests/Tests.n
   vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/TextManagement/ProjectManager.n
   vs-plugin/trunk/Nemerle.Compiler.Utils/Utils.n
   vs-plugin/trunk/Nemerle.VsIntegration/LanguageService/NemerleLanguageService.cs
   vs-plugin/trunk/Nemerle.VsIntegration/LanguageService/NemerleViewFilter.cs
   vs-plugin/trunk/Nemerle.VsIntegration/NemerlePackage.cs
   vs-plugin/trunk/Nemerle.VsIntegration/Project/NemerleProjectNode.cs
   vs-plugin/trunk/Nemerle.VsIntegration/Project/ProjectInfo.cs

Modified: vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/Checker.n
==============================================================================
--- vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/Checker.n	(original)
+++ vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/Checker.n	Sat Jan 20 01:39:30 2007
@@ -546,7 +546,7 @@
               msg += char.ToUpper(cm.Message[0]).ToString();
               msg += cm.Message.Substring(1);
 
-              msg.Replace("`", "'")
+              msg
             },
             err.Location,
             err.MessageKind);

Modified: vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/CompileUnitCollection.n
==============================================================================
--- vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/CompileUnitCollection.n	(original)
+++ vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/CompileUnitCollection.n	Sat Jan 20 01:39:30 2007
@@ -18,12 +18,18 @@
       [NotNull] regionsMap : Hashtable[int, list[Region]]
     )
     {
-      _engine     = engine;
+      Engine     = engine;
       _fileInfos  = fileInfos;
       _regionsMap = regionsMap
     }
 
-    _engine     : Engine;
+    public Engine : Engine
+    {
+      mutable _engine : Engine;
+      get         { ManagerClass.Instance = _engine; _engine; }
+      private set { _engine = value }
+    }
+    
     _fileInfos  : array[Decl.Namespace];
     _regionsMap : Hashtable[int, list[Region]];
 

Modified: vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/Formatter.n
==============================================================================
--- vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/Formatter.n	(original)
+++ vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/Formatter.n	Sat Jan 20 01:39:30 2007
@@ -42,11 +42,17 @@
   {
     mutable _startLine = 0;
     mutable _endLine = 0;
-    [Accessor] _engine : Engine;
+    
+    public Engine : Engine
+    {
+      mutable _engine : Engine;
+      get         { ManagerClass.Instance = _engine; _engine; }
+      private set { _engine = value }
+    }
 
     public this(engine : Engine)
     {
-      _engine = engine;
+      Engine = engine;
     }
 
     public FormatDocument(filePath : string) : SCG.List[FormatterResult]

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	Sat Jan 20 01:39:30 2007
@@ -96,12 +96,12 @@
       def findPossibleUsages(name, onlyThisFile)
       {
         mutable entries = [];
-        def sources = _engine.ProjectSources;
+        def sources = Engine.ProjectSources;
         def filesToSearchThrough =
           if (onlyThisFile)
             array[fileIndex]
           else
-            _engine.Sources.GetFileIndices();
+            Engine.Sources.GetFileIndices();
         foreach (fileIndex in filesToSearchThrough)
         {
           def source = sources.GetSource(fileIndex);
@@ -136,7 +136,7 @@
       
       def findInMethod(localValueDeclaration)
       {
-        def member = inType.Builder.GetActiveMember(fileIndex, line, column);
+        def member = inType.Builder.GetMemberByLocation(fileIndex, line, column);
         Debug.WriteLine($"searching for $localValueDeclaration");
         Debug.WriteLine($"enclosing member:\n $member");
         match (member)
@@ -170,7 +170,7 @@
             match (GetActiveDecl(usage.FileIndex, usage.Line, usage.Column))
             {
               | @type is Decl.Type =>
-                match (@type.Builder.GetActiveMember(usage.FileIndex, usage.Line, usage.Column))
+                match (@type.Builder.GetMemberByLocation(usage.FileIndex, usage.Line, usage.Column))
                 {
                   | method is MethodBuilder when method.IsBodyCompilable =>
                     debug(method);
@@ -208,7 +208,7 @@
   
     private GetChainOfEnclosingLocations(fileIndex : int, line : int, column : int) : list[Location]
     {
-      def source = _engine.ProjectSources.GetSource(fileIndex);
+      def source = Engine.ProjectSources.GetSource(fileIndex);
       def (lastLine, lastColumn) = source.GetLineIndexOfPosition(source.GetText().Length);
       def wholeFile = Location(fileIndex, 1, 1, lastLine, lastColumn);
       
@@ -252,8 +252,8 @@
       }
       and chainInsideType(typeBuilder)
       {
-        def members = typeBuilder.GetActiveMembers(fileIndex, line, column);
-        members.Map(_.Location) + chainInsideMember(typeBuilder.GetActiveMember(fileIndex, line, column));
+        def member = typeBuilder.GetMemberByLocation(fileIndex, line, column);
+        [member.Location] + chainInsideMember(typeBuilder.GetMemberByLocation(fileIndex, line, column));
       }
       and chainInsideMember(member : IMember)
       {

Modified: vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/Project.Relocation.n
==============================================================================
--- vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/Project.Relocation.n	(original)
+++ vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/Project.Relocation.n	Sat Jan 20 01:39:30 2007
@@ -35,7 +35,7 @@
 
       def member = match (GetActiveDecl(fileIndex, startLine,  startChar))
       {
-        | Decl.Type as ty => ty.Builder.GetActiveMember(fileIndex, startLine, startChar);
+        | Decl.Type as ty => ty.Builder.GetMemberByLocation(fileIndex, startLine, startChar);
         | GlobalAttribute | Using | Namespace | None => null
       };
 

Modified: vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/Project.Type.n
==============================================================================
--- vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/Project.Type.n	(original)
+++ vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/Project.Type.n	Sat Jan 20 01:39:30 2007
@@ -32,7 +32,7 @@
     {
       def typeBuilder = @type.Builder;
       // Find member under cursor
-      def member = typeBuilder.GetActiveMember(fileIndex, line, col);
+      def member = typeBuilder.GetMemberByLocation(fileIndex, line, col);
 
       def scanMethod(method)
       {
@@ -41,7 +41,7 @@
         if (loc.Contains(line, col)) // completion in method body
         {
           def bodyCode = source.GetRegion(loc.Line, loc.Column, loc.EndLine, loc.EndColumn);
-          def result   = _engine.RunCompletionEngine(method, bodyCode, loc, line, col);
+          def result   = Engine.RunCompletionEngine(method, bodyCode, loc, line, col);
 
           if (result == null)
           {
@@ -55,29 +55,18 @@
           this.Engine.ComplateWordInMethodHeader(method.Ast, fileIndex, line, col, source);
       }
 
-      def FindCorrespondMethod(isMethodFound)
+      def FindCorrespondMethod()
       {
-        def result = typeBuilder.GetActiveMember(fileIndex, line, col,
-          fun(member1, member2)
-          {
-            | (p,                    m is MethodBuilder)
-            | (m is MethodBuilder,   p)                 => if (isMethodFound(m)) m else p
-            | _ => 
-              def doIgnore(m) { | m is MethodBuilder => m.IsGenerated | _ => false }
-              if (doIgnore(member1))      if (doIgnore(member2)) null else member2
-              else if (doIgnore(member2)) null
-              else                        member2
-
-          });
+        def result = typeBuilder.GetMemberByLocation(fileIndex, line, col);
         
         match (result) { m is MethodBuilder => scanMethod(m) | _ => TopKeywords }
       }
 
       match (member)
       {
-        | prop is PropertyBuilder => 
-          def isAccessor(m : MemberBuilder) { prop.GetGetter() == m : object || prop.GetSetter() == m : object }
-          FindCorrespondMethod(isAccessor);
+        | _ is PropertyBuilder => 
+          //def isAccessor(m : MemberBuilder) { prop.GetGetter() == m : object || prop.GetSetter() == m : object }
+          FindCorrespondMethod();
 
         | method is MethodBuilder => scanMethod(method)
         | null => this.Engine.CompleteDeclarationBase(
@@ -105,30 +94,7 @@
       def typeBuilder = typeDecl.Builder;
       def member      = 
         if (typeBuilder.IsDelegate) typeBuilder : IMember
-        else typeBuilder.GetActiveMember(fileIndex, line, col,
-          fun(member1, member2)
-          {
-            def doIgnore(m)
-            {
-              | m is MethodBuilder => m.IsGenerated || m.BodyLocation.FileIndex <= 0 
-              | _ => false
-            }
-
-            if (doIgnore(member1))
-              if (doIgnore(member2)) null else member2
-            else if (doIgnore(member2))
-              member1
-            else
-            {
-              def loc1 = member1.Location;
-              def loc2 = member2.Location;
-
-              if (loc1 == loc2)
-                if (member2 is PropertyBuilder) member2 else member1
-              else
-                if (loc1.Intersect(loc2) == loc1) member1 else member2
-            }
-          });
+        else typeBuilder.GetMemberByLocation(fileIndex, line, col);
 
       def checkType(pexpr, texpr) 
       {
@@ -369,7 +335,7 @@
       : MethodTipInfo
     {
       def typeBuilder = typeDecl.Builder;
-      def member      = typeBuilder.GetActiveMember(fileIndex, line, col);
+      def member      = typeBuilder.GetMemberByLocation(fileIndex, line, col);
 
       match (member)
       {
@@ -389,7 +355,7 @@
             {
             | Some(group) =>
 
-              def result = _engine.RunCompletionEngine(
+              def result = Engine.RunCompletionEngine(
                 method, bodyCode, loc, group.Location.Line, group.Location.Column);
 
               if (result != null)

Modified: vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/Project.n
==============================================================================
--- vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/Project.n	(original)
+++ vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/Project.n	Sat Jan 20 01:39:30 2007
@@ -24,7 +24,13 @@
   [Record]
   public partial class Project
   {
-    [Accessor] _engine        : Engine;
+    public Engine : Engine
+    {
+      mutable _engine : Engine;
+      get         { ManagerClass.Instance = _engine; _engine; }
+      private set { _engine = value }
+    }
+
     [Accessor] _compileUnits  : CompileUnitCollection;
     [Accessor] _namespaceTree : NamespaceTree.Node;
     [Accessor] _errors        : list[CompilerMessage];
@@ -207,7 +213,7 @@
       match (decl)
       {
       | Using as us => this.Engine.GetUsingQuickTip(us, fileIndex, line, col)
-      | Type  as tp => GetTypeQuickTip (tp, fileIndex, line, col, _engine);
+      | Type  as tp => GetTypeQuickTip (tp, fileIndex, line, col, Engine);
       | _           => null
       }
     }

Modified: vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/QuickTipInfo.n
==============================================================================
--- vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/QuickTipInfo.n	(original)
+++ vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/QuickTipInfo.n	Sat Jan 20 01:39:30 2007
@@ -214,7 +214,7 @@
                   match (f)
                   {
                   | f is FieldBuilder when f.IsLiteral =>
-                    match (f.const_value)
+                    match (f.ConstValue)
                     {
                     | Integer(f_val, f_is_negative, _) =>
 

Modified: vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/DefineCollection.n
==============================================================================
--- vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/DefineCollection.n	(original)
+++ vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/DefineCollection.n	Sat Jan 20 01:39:30 2007
@@ -1,4 +1,5 @@
 using System;
+
 using Nemerle.Assertions;
 using Nemerle.Collections;
 using Nemerle.Compiler;
@@ -16,19 +17,25 @@
     internal this (eng : Engine)
     {
       _defines = [];
-      _engine = eng;
+      Engine = eng;
     }
     
     internal mutable _defines : list[string];
-    _engine : Engine;
+
+    public Engine : Engine
+    {
+      mutable _engine : Engine;
+      get         { ManagerClass.Instance = _engine; _engine; }
+      private set { _engine = value }
+    }
     
     public Add (define : string) : void
     {
         unless (_defines.Contains (define))
         {
             _defines ::= define;
-            _engine.Options.DefineConstant (define);
-            _engine.ResetTypeTree();
+            Engine.Options.DefineConstant (define);
+            Engine.ResetTypeTree();
         }
     }
     
@@ -37,8 +44,8 @@
         when (_defines.Contains (define))
         {
             _ = _defines.Remove(define);
-            _engine.Options.UndefineConstant(define);
-            _engine.ResetTypeTree();
+            Engine.Options.UndefineConstant(define);
+            Engine.ResetTypeTree();
         }
     }
     
@@ -52,9 +59,9 @@
         unless (_defines.Length == 0)
         {
             foreach (define in _defines)
-                _engine.Options.UndefineConstant (define);
+                Engine.Options.UndefineConstant (define);
             _defines = [];
-            _engine.ResetTypeTree();
+            Engine.ResetTypeTree();
         }
     }
     

Modified: vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/ReferenceCollection.n
==============================================================================
--- vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/ReferenceCollection.n	(original)
+++ vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/ReferenceCollection.n	Sat Jan 20 01:39:30 2007
@@ -17,19 +17,25 @@
       internal this (eng : Engine)
       {
         references = Hashtable ();
-        _engine = eng;
+        Engine = eng;
       }
       
       internal mutable references : Hashtable[string, InternalReference];
-      _engine : Engine;
+
+      public Engine : Engine
+      {
+        mutable _engine : Engine;
+        get         { ManagerClass.Instance = _engine; _engine; }
+        private set { _engine = value }
+      }
       
       public Add (key : string, path : string) : void
       {
         unless (references.Contains (key))
         {
           references.Add (key, InternalReference.Library (path));
-          _engine.AddLibrary(path);
-          _engine.ResetTypeTree();
+          Engine.AddLibrary(path);
+          Engine.ResetTypeTree();
         }
       }
       
@@ -38,8 +44,8 @@
         unless (references.Contains (key))
         {
           references.Add (key, InternalReference.Assembly (loadedAssembly));
-          _engine.AddAssembly (loadedAssembly);
-          _engine.ResetTypeTree();
+          Engine.AddAssembly (loadedAssembly);
+          Engine.ResetTypeTree();
         }
       }
       
@@ -48,13 +54,13 @@
         when (references.Contains (key))
         {
           references.Remove (key);
-          _engine._state = EngineState.Pure;
-          _engine.ResetTypeTree();
+          Engine._state = EngineState.Pure;
+          Engine.ResetTypeTree();
           
           foreach (reference in references.Values)
           {
-          | Library as l => _engine.AddLibrary(l.path);
-          | Assembly as a => _engine.AddAssembly (a.assembly);
+          | Library  as l => Engine.AddLibrary(l.path);
+          | Assembly as a => Engine.AddAssembly (a.assembly);
           }
         }
       }
@@ -62,8 +68,8 @@
       public Clear () : void
       {
         references = Hashtable ();
-        _engine._state = EngineState.Pure;
-        _engine.ResetTypeTree();
+        Engine._state = EngineState.Pure;
+        Engine.ResetTypeTree();
       }
       
       public ContainsKey (key : string) : bool

Modified: vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/SourceCollection.n
==============================================================================
--- vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/SourceCollection.n	(original)
+++ vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/SourceCollection.n	Sat Jan 20 01:39:30 2007
@@ -15,11 +15,16 @@
   {
     public class SourceCollection
     {
-      _engine : Engine;
+      public Engine : Engine
+      {
+        mutable _engine : Engine;
+        get         { ManagerClass.Instance = _engine; _engine; }
+        private set { _engine = value }
+      }
 
       internal this (engine : Engine)
       {
-        _engine  = engine;
+        Engine  = engine;
         _sources = Hashtable();
       }
       
@@ -36,7 +41,7 @@
         when (!ContainsKey(file))
         {
           _fileIndices.Add(Location.GetFileIndex(file));
-          _engine.ResetTypeTree();
+          Engine.ResetTypeTree();
         }
 
         _sources[file] = content;
@@ -47,13 +52,13 @@
         def ok = _fileIndices.Remove(Location.GetFileIndex(file));
         assert(ok);
         _sources.Remove(file);
-        _engine.ResetTypeTree();
+        Engine.ResetTypeTree();
       }
 
       public Clear () : void
       {
         _sources.Clear();
-        _engine.ResetTypeTree();
+        Engine.ResetTypeTree();
       }
 
       public ContainsKey (file : string) : bool { _sources.ContainsKey (file) }

Modified: vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/Tests/Tests.n
==============================================================================
--- vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/Tests/Tests.n	(original)
+++ vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/Tests/Tests.n	Sat Jan 20 01:39:30 2007
@@ -470,7 +470,7 @@
       def decl = _project.GetActiveDecl(file, line, col);
       CheckType (decl, "Ns1.Ns2.Ns3.ClassInNestenNs");
       def tb = (decl :> Decl.Type).Builder;
-      def member = tb.GetActiveMember(Location.GetFileIndex(file), line, col);
+      def member = tb.GetMemberByLocation(Location.GetFileIndex(file), line, col);
       CheckMethod(member, "Method");
     }
 
@@ -494,7 +494,7 @@
       def decl = _project.GetActiveDecl(file, line, col);
       CheckType (decl, "Tests.Class1");
       def tb = (decl :> Decl.Type).Builder;
-      def member = tb.GetActiveMember(Location.GetFileIndex(file), line, col);
+      def member = tb.GetMemberByLocation(Location.GetFileIndex(file), line, col);
       CheckMethod(member, "Main");
     }
 
@@ -506,7 +506,7 @@
       def decl = _project.GetActiveDecl(file, line, col);
       CheckType (decl, "Tests.Class1");
       def tb = (decl :> Decl.Type).Builder;
-      def member = tb.GetActiveMember(Location.GetFileIndex(file), line, col);
+      def member = tb.GetMemberByLocation(Location.GetFileIndex(file), line, col);
       CheckMethod(member, "Main");
     }
 
@@ -518,7 +518,7 @@
       def decl = _project.GetActiveDecl(file, line, col);
       CheckType (decl, "Class2");
       def tb = (decl :> Decl.Type).Builder;
-      def member = tb.GetActiveMember(Location.GetFileIndex(file), line, col);
+      def member = tb.GetMemberByLocation(Location.GetFileIndex(file), line, col);
       CheckMethod(member, "Method");
     }
 
@@ -665,7 +665,7 @@
       CheckType (decl, "Class5");
 
       def tb   = (decl :> Decl.Type).Builder;
-      def prop = tb.GetActiveMember(Location.GetFileIndex(file), line, col);
+      def prop = tb.GetMemberByLocation(Location.GetFileIndex(file), line, col);
 
       CheckProperty(prop, "Prop");
 

Modified: vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/TextManagement/ProjectManager.n
==============================================================================
--- vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/TextManagement/ProjectManager.n	(original)
+++ vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/TextManagement/ProjectManager.n	Sat Jan 20 01:39:30 2007
@@ -1,4 +1,5 @@
 using System;
+
 using Nemerle.Compiler;
 using Nemerle.Utility;
 
@@ -6,7 +7,12 @@
 {
   public class ProjectManager : IProjectSources
   {
-    [Accessor (flags = WantSetter)] mutable _engine : Engine;
+    public Engine : Engine
+    {
+      mutable _engine : Engine;
+      get { ManagerClass.Instance = _engine; _engine; }
+      set { _engine = value }
+    }
 
     /// Get manager of code file by file path.
     public virtual GetSource(filePath : string) : ISource

Modified: vs-plugin/trunk/Nemerle.Compiler.Utils/Utils.n
==============================================================================
--- vs-plugin/trunk/Nemerle.Compiler.Utils/Utils.n	(original)
+++ vs-plugin/trunk/Nemerle.Compiler.Utils/Utils.n	Sat Jan 20 01:39:30 2007
@@ -201,77 +201,55 @@
       glyphType :> int;
     }
 
-    public GetActiveMember(
+    public GetMemberByLocation(
       this typeBuilder : TypeBuilder, 
       fileIndex        : int,
       line             : int,
-      col              : int,
-      comparator       : MemberBuilder * MemberBuilder -> MemberBuilder
+      col              : int
     )
       : MemberBuilder
     {
-      assert(true);
-      def members = typeBuilder.GetActiveMembers(fileIndex, line, col);
-
-      def filter(mlist)
+      def find(members : list[IMember]) 
       {
-      | [m] => m
-      | []  => null
-      | m1 :: ((m2 :: tail) as m2_tail) =>
+      | member :: tail => 
 
-        if (m1.IsGenerated)
-          if (m2.IsGenerated) filter(tail);
-          else filter(m2_tail)
-        else
+        match (member)
         {
-          def m = comparator(m1, m2);
-          filter(if (m == null) tail else m :: tail)
-        }
-      }
+        | tb is TypeBuilder     => 
 
-      filter(members)
-    }
+          def m = GetMemberByLocation(tb, fileIndex, line, col);
 
-    public GetActiveMember(
-      this typeBuilder : TypeBuilder, 
-      fileIndex        : int,
-      line             : int,
-      col              : int,
-    )
-      : MemberBuilder
-    {
-      typeBuilder.GetActiveMember(fileIndex, line, col, (m, _) => m);
-    }
+          if (m != null) m else find(tail)
 
-    public GetActiveMembers(
-      this typeBuilder : TypeBuilder,
-      fileIndex        : int,
-      line             : int,
-      col              : int
-    )
-      : list[MemberBuilder]
-    {
-      def loop(members : list[IMember])
-      {
-        | member :: tail =>
-          match (member)
-          {
-            | tb is TypeBuilder   =>
-              tb.GetActiveMembers(fileIndex, line, col) + loop(tail)
+        //| pb is PropertyBuilder =>
+
+        //  def mb = find([pb.GetGetter(), pb.GetSetter()]);
+
+        //  if (mb != null)
+        //    mb
+        //  else if (!pb.IsGenerated && pb.Location.Contains(fileIndex, line, col))
+        //    pb
+        //  else
+        //    null
 
             | mb is MethodBuilder =>
-              if (mb.Location.Contains(fileIndex, line, col)
-                || mb.BodyLocation.Contains(fileIndex, line, col)
-              )    mb :: loop(tail)
-              else loop(tail)
-
-            | member is MemberBuilder
-              when member.Location.Contains(fileIndex, line, col) =>
-                member :: loop(tail)
 
-            | _ => loop(tail)
+          if (!mb.IsGenerated &&
+              (mb.Location.Contains(fileIndex, line, col) ||
+               mb.BodyLocation.Contains(fileIndex, line, col)))
+            mb
+          else
+            find(tail)
+
+        | mb is MemberBuilder
+          when !mb.IsGenerated && mb.Location.Contains(fileIndex, line, col) => 
+
+            mb
+
+        | _ => find(tail)
           }
-        | [] => []
+
+      | [] => null
       }
 
       def members = typeBuilder.GetMembers(
@@ -279,7 +257,7 @@
         BindingFlags.Public %| BindingFlags.NonPublic %|
         BindingFlags.DeclaredOnly);
 
-      loop(members);
+      find(members)
     }
 
     public GetLocalPath(this asm : Assembly) : string

Modified: vs-plugin/trunk/Nemerle.VsIntegration/LanguageService/NemerleLanguageService.cs
==============================================================================
--- vs-plugin/trunk/Nemerle.VsIntegration/LanguageService/NemerleLanguageService.cs	(original)
+++ vs-plugin/trunk/Nemerle.VsIntegration/LanguageService/NemerleLanguageService.cs	Sat Jan 20 01:39:30 2007
@@ -146,7 +146,7 @@
 
 						sink.AddError(
 							request.FileName,
-							cm.Message,
+							cm.Message.Replace("`", "'"),
 							ts,
 							cm.MessageKind == MessageKind.Error?   Severity.Error :
 							cm.MessageKind == MessageKind.Warning? Severity.Warning :

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	Sat Jan 20 01:39:30 2007
@@ -80,6 +80,7 @@
 
 					break;
 			}
+
 			if (txt != null)
 			    System.Diagnostics.Trace.Assert(false, "Implement the menu!\r\nID: " + txt);
 			

Modified: vs-plugin/trunk/Nemerle.VsIntegration/NemerlePackage.cs
==============================================================================
--- vs-plugin/trunk/Nemerle.VsIntegration/NemerlePackage.cs	(original)
+++ vs-plugin/trunk/Nemerle.VsIntegration/NemerlePackage.cs	Sat Jan 20 01:39:30 2007
@@ -106,20 +106,13 @@
 	#endregion
 
 	public class NemerlePackage : ProjectPackage, IOleComponent, IVsInstalledProduct
-		, IOleCommandTarget
 	{
+		#region Fields
+
 		private uint                  _componentID;
 		private NemerleLibraryManager _libraryManager;
 
-		protected override int QueryClose(out bool canClose)
-		{
-			int res = base.QueryClose(out canClose);
-			if (canClose)
-			{
-				Settings.Default.Save();
-			}
-			return  res;
-		}
+		#endregion
 
 		#region Initialize
 
@@ -147,13 +140,7 @@
 
 			if (menuService != null)
 			{
-				RegisterCommand(menuService, MenuCmd.ExtendSelection, OnExtendSelection);
 				RegisterCommand(menuService, MenuCmd.AstToolWindow,   OnAstToolWindowShow);
-				// TODO: change handlers
-				RegisterCommand(menuService, MenuCmd.ShrinkSelection, OnExtendSelection);
-				RegisterCommand(menuService, MenuCmd.Rename,          OnExtendSelection);
-				RegisterCommand(menuService, MenuCmd.Inline,          OnExtendSelection);
-				RegisterCommand(menuService, MenuCmd.Options,         OnExtendSelection);
 			}
 			else
 				Trace.WriteLine("Command Service is null!");
@@ -166,45 +153,6 @@
 			//Debug.WriteLine(string.Format("Menu command {0} added", command));
 		}
 
-		/// <summary>
-		/// This function is called when the user clicks the menu item that shows the 
-		/// tool window. See the Initialize method to see how the menu item is associated to 
-		/// this function using the OleMenuCommandService service and the MenuCommand class.
-		/// </summary>
-		internal void OnAstToolWindowShow(object sender, EventArgs e)
-		{
-			// Get the instance number 0 of this tool window. This window is single instance so this instance
-			// is actually the only one.
-			// The last flag is set to true so that if the tool window does not exists it will be created.
-			ToolWindowPane window = FindToolWindow(typeof(AstToolWindow), 0, true);
-			if (window == null || window.Frame == null)
-				throw new COMException("Can not create window.");
-
-			IVsWindowFrame windowFrame = (IVsWindowFrame)window.Frame;
-			ErrorHandler.ThrowOnFailure(windowFrame.Show());
-		}
-
-		//phantom: this handler doesn't want to be leashed, try to do tie it up, guys!
-		private void OnExtendSelection(object sender, EventArgs e)
-		{
-			Debug.WriteLine("Extend Selection called");
-			IVsUIShell uiShell = (IVsUIShell)GetService(typeof(SVsUIShell));
-			Guid clsid = Guid.Empty;
-			int result;
-			uiShell.ShowMessageBox(
-					   0,
-					   ref clsid,
-					   "Package Name",
-					   string.Format(System.Globalization.CultureInfo.CurrentCulture, "Inside {0}.MenuItemCallback()", this.ToString()),
-					   string.Empty,
-					   0,
-					   OLEMSGBUTTON.OLEMSGBUTTON_OK,
-					   OLEMSGDEFBUTTON.OLEMSGDEFBUTTON_FIRST,
-					   OLEMSGICON.OLEMSGICON_INFO,
-					   0,        // false
-					   out result);
-		}
-
 		private object CreateService(IServiceContainer container, Type serviceType)
 		{
 			if (serviceType == typeof(NemerleLanguageService))
@@ -244,6 +192,28 @@
 
 		#endregion
 
+		#region Commands
+
+		/// <summary>
+		/// This function is called when the user clicks the menu item that shows the 
+		/// tool window. See the Initialize method to see how the menu item is associated to 
+		/// this function using the OleMenuCommandService service and the MenuCommand class.
+		/// </summary>
+		internal void OnAstToolWindowShow(object sender, EventArgs e)
+		{
+			// Get the instance number 0 of this tool window. This window is single instance so this instance
+			// is actually the only one.
+			// The last flag is set to true so that if the tool window does not exists it will be created.
+			ToolWindowPane window = FindToolWindow(typeof(AstToolWindow), 0, true);
+			if (window == null || window.Frame == null)
+				throw new COMException("Can not create window.");
+
+			IVsWindowFrame windowFrame = (IVsWindowFrame)window.Frame;
+			ErrorHandler.ThrowOnFailure(windowFrame.Show());
+		}
+
+		#endregion
+
 		#region GetService()
 
 		internal T GetService<T>(bool throwIfFail)
@@ -316,6 +286,22 @@
 		
 		#endregion
 
+		#region Overrides
+
+		protected override int QueryClose(out bool canClose)
+		{
+			int res = base.QueryClose(out canClose);
+
+			if (canClose)
+			{
+				Settings.Default.Save();
+			}
+
+			return  res;
+		}
+
+		#endregion
+
 		#region IOleComponent Members
 
 		public int FContinueMessageLoop(uint uReason, IntPtr pvLoopData, MSG[] pMsgPeeked)
@@ -399,16 +385,5 @@
 		}
 
 		#endregion
-
-		int IOleCommandTarget.Exec(ref Guid pguidCmdGroup, uint nCmdID, uint nCmdexecopt, IntPtr pvaIn, IntPtr pvaOut)
-		{
-			throw new Exception("The method or operation is not implemented.");
-		}
-
-		int IOleCommandTarget.QueryStatus(ref Guid pguidCmdGroup, uint cCmds, OLECMD[] prgCmds, IntPtr pCmdText)
-		{
-			//throw new Exception("The method or operation is not implemented.");
-			return 0;
-		}
 	}
 }

Modified: vs-plugin/trunk/Nemerle.VsIntegration/Project/NemerleProjectNode.cs
==============================================================================
--- vs-plugin/trunk/Nemerle.VsIntegration/Project/NemerleProjectNode.cs	(original)
+++ vs-plugin/trunk/Nemerle.VsIntegration/Project/NemerleProjectNode.cs	Sat Jan 20 01:39:30 2007
@@ -155,8 +155,6 @@
 
 		#region Overridden Properties
 
-		// Needed since ProjectNode.ImageIndex returns 
-		// ProjectNode.ImageName.Application.
 		public   override int    ImageIndex  { get { return NemerleConstants.ImageListIndex.NemerleProject; } }
 		public   override Guid   ProjectGuid { get { return typeof(NemerleProjectFactory).GUID; } }
 		public   override string ProjectType { get { return NemerleConstants.LanguageName;      } }

Modified: vs-plugin/trunk/Nemerle.VsIntegration/Project/ProjectInfo.cs
==============================================================================
--- vs-plugin/trunk/Nemerle.VsIntegration/Project/ProjectInfo.cs	(original)
+++ vs-plugin/trunk/Nemerle.VsIntegration/Project/ProjectInfo.cs	Sat Jan 20 01:39:30 2007
@@ -52,10 +52,11 @@
 			options.DoNotLoadMacros = NoStdMacros;
 			ProjectManager projectManager = new ProjectManager(languageService);
 
-			_engine = new Engine(options, projectManager,
-				new TraceWriter()); // it enables parser working.
-			projectManager.Engine = _engine;
-			_engine.TypedtreeCreated += delegate
+			_engine = new Engine(options, projectManager, new TraceWriter()); // it enables parser working.
+
+			projectManager.Engine = Engine;
+
+			Engine.TypedtreeCreated += delegate
 			{
 				_buildTypedtreeCount++;
 				AstToolWindow tool = AstToolWindow.AstTool;
@@ -76,13 +77,13 @@
 
 		public void Init()
 		{
-			_engine.Init();
+			Engine.Init();
 		}
 
 		private Engine _engine;
 		public  Engine  Engine
 		{
-			get { return _engine; }
+			get { ManagerClass.Instance = _engine; return _engine; }
 		}
 
 		private NemerleProjectNode _projectNode;
@@ -287,12 +288,12 @@
 
 		public bool IsProjectAvailable
 		{
-			get { return _engine.IsProjectAvailable; }
+			get { return Engine.IsProjectAvailable; }
 		}
 
 		public void ResetTypeTree()
 		{
-			_engine.ResetTypeTree();
+			Engine.ResetTypeTree();
 		}
 
 		public void AddRelocation(



More information about the svn mailing list