[svn] r7337: vs-plugin/trunk: Nemerle.Compiler.Utils/Nemerle.Compiler.Utils.csproj Nemerle.Compiler.Utils/...

VladD2 svnadmin at nemerle.org
Thu Jan 25 12:40:25 CET 2007


Log:
1. Move IntelliSense factories from compiler.
2. Sync with compiler.

Author: VladD2
Date: Thu Jan 25 12:40:22 2007
New Revision: 7337

Added:
   vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CompilerConcreteDefinitions/IntelliSenseModeLibraryReferenceManager.n
   vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CompilerConcreteDefinitions/IntelliSenseModeTyper.n
Modified:
   vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Compiler.Utils.csproj
   vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/XmlDocReader.n
   vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CompilerConcreteDefinitions/Factories/Factories.n
   vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/Engine/Engine.Completion.n
   vs-plugin/trunk/Nemerle.VsIntegration/!ToDo/ToDo.txt

Modified: vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Compiler.Utils.csproj
==============================================================================
--- vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Compiler.Utils.csproj	(original)
+++ vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Compiler.Utils.csproj	Thu Jan 25 12:40:22 2007
@@ -125,7 +125,6 @@
   <ItemGroup>
     <Service Include="{B4F97281-0DBD-4835-9ED8-7DFB966E87FF}" />
   </ItemGroup>
-
   <ItemGroup>
     <Compile Include="Nemerle.Completion2\Engine\Engine-overrides.n" />
   </ItemGroup>
@@ -133,6 +132,10 @@
     <Compile Include="Nemerle.Completion2\CompilerConcreteDefinitions\Factories\Factories.n" />
     <Compile Include="Nemerle.Completion2\CompilerConcreteDefinitions\IntelliSenseModeMethodBuilder.n" />
   </ItemGroup>
+  <ItemGroup>
+    <Compile Include="Nemerle.Completion2\CompilerConcreteDefinitions\IntelliSenseModeTyper.n" />
+    <Compile Include="Nemerle.Completion2\CompilerConcreteDefinitions\IntelliSenseModeLibraryReferenceManager.n" />
+  </ItemGroup>
   <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
   <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
        Other similar extension points exist, see Microsoft.Common.targets.

Modified: vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/XmlDocReader.n
==============================================================================
--- vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/XmlDocReader.n	(original)
+++ vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/XmlDocReader.n	Thu Jan 25 12:40:22 2007
@@ -119,9 +119,9 @@
       {
       | Class       (tycon, _) => getName(tycon);
       | TyVarRef    (tyvar)    => tyvar.Name;
-      | Fun         (from, to) => "(todo)";
-      | Tuple       (args)     => "(todo)";
-      | Array       (t, rank)  => getTypeName(t.Fix()) + "[]"; // Todo: rank
+      | Fun         (_from, _to) => "(todo)";
+      | Tuple       (_args)     => "(todo)";
+      | Array       (t, _rank)  => getTypeName(t.Fix()) + "[]"; // Todo: rank
       | Ref         (t)
       | Out         (t)        => getTypeName(t.Fix());
       | Void                   => throw InvalidOperationException("Got void as method parameter");

Modified: vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CompilerConcreteDefinitions/Factories/Factories.n
==============================================================================
--- vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CompilerConcreteDefinitions/Factories/Factories.n	(original)
+++ vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CompilerConcreteDefinitions/Factories/Factories.n	Thu Jan 25 12:40:22 2007
@@ -4,5 +4,7 @@
 namespace Nemerle.Completion2.Factories
 {
   [AbstractFactory(Override(IntelliSenseModeMethodBuilder, MethodBuilder))]
+  [AbstractFactory(Override(IntelliSenseModeLibraryReferenceManager, LibraryReferenceManager))]
+  [AbstractFactory(Override(IntelliSenseModeTyper, Typer))]
   public class IntelliSenseModeCompilerComponentsFactory : CompilerComponentsFactory { }
 }

Added: vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CompilerConcreteDefinitions/IntelliSenseModeLibraryReferenceManager.n
==============================================================================
--- (empty file)
+++ vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CompilerConcreteDefinitions/IntelliSenseModeLibraryReferenceManager.n	Thu Jan 25 12:40:22 2007
@@ -0,0 +1,72 @@
+using System;
+using Nemerle.Assertions;
+using Nemerle.Compiler;
+using Nemerle.Utility;
+using Nemerle.Collections;
+using Nemerle.Compiler.Parsetree;
+using Nemerle.Compiler.Typedtree;
+using System.Diagnostics;
+
+using Typed = Nemerle.Compiler.Typedtree;
+using SR = System.Reflection;
+using SCG = System.Collections.Generic;
+
+namespace Nemerle.Completion2.Factories
+{
+  public class IntelliSenseModeLibraryReferenceManager : LibraryReferenceManager
+  {
+    public this (man : ManagerClass, lib_paths : list [string]) { base (man, lib_paths); }
+    /// static cache to workaround problems with multiple loading of the 
+    /// same assemblies from GAC
+    static assByString : Hashtable [string, SR.Assembly] = Hashtable ();
+    static assByStrongName : Hashtable [string, SR.Assembly] = Hashtable ();
+    
+    public static CleanCache () : void
+    {
+      assByString.Clear ();
+      assByStrongName.Clear ();
+    }
+    
+    protected override assemblyLoad (name : string) : SR.Assembly
+    {
+      mutable assembly;
+
+      unless (assByString.TryGetValue (name, out assembly)) 
+      {
+        assembly = base.assemblyLoad(name);
+        assByString.Add(name, assembly);
+        assByStrongName.Add(assembly.FullName, assembly);
+      }
+
+      assembly
+    }
+        
+    protected override assemblyLoad (name : SR.AssemblyName) : SR.Assembly
+    {
+      def fullName = name.FullName;
+      mutable assembly;
+
+      unless (assByStrongName.TryGetValue (fullName, out assembly))
+      {
+        assembly = base.assemblyLoad(name);
+        assByStrongName.Add(fullName, assembly);
+      }
+
+      assembly
+    }
+
+    protected override assemblyLoadFrom (path : string) : SR.Assembly
+    {
+      mutable assembly;
+
+      unless (assByString.TryGetValue (path, out assembly)) 
+      {
+        assembly = base.assemblyLoadFrom(path);
+        assByString.Add(path, assembly);
+        assByStrongName.Add(assembly.FullName, assembly);
+      }
+
+      assembly
+    }
+  }
+}

Added: vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CompilerConcreteDefinitions/IntelliSenseModeTyper.n
==============================================================================
--- (empty file)
+++ vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CompilerConcreteDefinitions/IntelliSenseModeTyper.n	Thu Jan 25 12:40:22 2007
@@ -0,0 +1,32 @@
+using System;
+using Nemerle.Assertions;
+using Nemerle.Compiler;
+using Nemerle.Utility;
+using Nemerle.Collections;
+using Nemerle.Compiler.Parsetree;
+using Nemerle.Compiler.Typedtree;
+using System.Diagnostics;
+
+using Typed = Nemerle.Compiler.Typedtree;
+using SR = System.Reflection;
+using SCG = System.Collections.Generic;
+
+namespace Nemerle.Completion2.Factories
+{
+  public class IntelliSenseModeTyper : Typer
+  {
+    public this (m : MethodBuilder) { base (m) }
+    public this (parent : Typer, fn : Typedtree.Fun_header) { base (parent, fn) }
+    public this (
+      tb : TypeBuilder, 
+      tenv : TyVarEnv,
+      fn : Typedtree.Fun_header,
+      env : GlobalEnv)
+    {
+      base (tb, tenv, fn, env)
+    }
+    
+    protected override RunDelayedTypings () : void { /* DO NOTHING */ }
+    protected override RunSecondPass (_ : MethodBuilder) : void { /* DO NOTHING */ }
+  }
+}

Modified: vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/Engine/Engine.Completion.n
==============================================================================
--- vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/Engine/Engine.Completion.n	(original)
+++ vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/Engine/Engine.Completion.n	Thu Jan 25 12:40:22 2007
@@ -117,6 +117,26 @@
 
         | cls is TopDeclaration.Class =>
           _ = cls;
+
+          unless (cls.t_extends.IsEmpty)
+          {
+            //def expr = cls.t_extends.Head;
+            def ctx = cls.ParsedName.context;
+            def expr = PExpr.ToComplete(Name("ManagerCla", MacroColors.Color, ctx));
+            try
+            {
+              _ = TyVarEnv(this).MonoBind(ctx, null, expr, false);
+            }
+            catch
+            { | e is CompletionResult =>
+              Trace.WriteLine($"NamePrefix: $(e.NamePrefix)");
+              def objectType = e.ObjectType ?? "<null>" : object;
+              Trace.WriteLine($" ObjectType: $objectType");
+              def elems = e.Elems.ToList();
+              Trace.WriteLine($" Elems: $elems");
+            }
+          }
+          
           TopKeywords
 
         | _ => TopKeywords
@@ -259,7 +279,7 @@
           def tryInterpretAsQualifiedName() : void
           {
             // Try interpret as qualified name...
-            def overloads = typer.TypeNameFull(expression, Solver.FreshTyVar (), true);
+            def overloads = typer.TypeNameFull(expression, typer.Solver.FreshTyVar (), true);
             AddOverloads(overloads);
           }
 

Modified: vs-plugin/trunk/Nemerle.VsIntegration/!ToDo/ToDo.txt
==============================================================================
--- vs-plugin/trunk/Nemerle.VsIntegration/!ToDo/ToDo.txt	(original)
+++ vs-plugin/trunk/Nemerle.VsIntegration/!ToDo/ToDo.txt	Thu Jan 25 12:40:22 2007
@@ -36,3 +36,4 @@
 15. Ðåàëèçîâàòü êîìïëèò â ïàðìåòðàõ ëàìä è ëîêàëüíûõ ôóíêöèé.
 16. Õèíò äëÿ ïîëåé èç òèïîâ îáúÿâëåííûõ â äðóãèõ ñáîðêàõ âûâîäèòñÿ áåç óêàçàíèÿ 
     òèïà ïîëÿ. Âûâîäèòñÿ îí ÷åðåç ToString(). Íàäî áû ýòî äåëî ïîäïðàâèòü.
\ No newline at end of file
+17. Ãëþ÷èò êîìïëèò òèïà "IO.Fi|". Íå âûäàåò File.
\ No newline at end of file



More information about the svn mailing list