[svn] r7447: vs-plugin/trunk/Nemerle.Compiler.Utils:
Nemerle.Compiler.Utils.csproj Nemerle.Completion2/Cod...
VladD2
svnadmin at nemerle.org
Mon Feb 19 06:04:51 CET 2007
Log:
Work on override completion.
Author: VladD2
Date: Mon Feb 19 06:04:48 2007
New Revision: 7447
Modified:
vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Compiler.Utils.csproj
vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/ScanLexer.n
vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CompilerConcreteDefinitions/IntelliSenseModeTyper.n
vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/Engine/CompletionElem.n
vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/Engine/Engine.Completion.n
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 Mon Feb 19 06:04:48 2007
@@ -141,6 +141,9 @@
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
</ItemGroup>
+ <ItemGroup>
+ <Compile Include="Nemerle.Completion2\Engine\CompletionElemFlags.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/ScanLexer.n
==============================================================================
--- vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/ScanLexer.n (original)
+++ vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/ScanLexer.n Mon Feb 19 06:04:48 2007
@@ -658,7 +658,11 @@
if (pos >= reader.Length && tok2 == " ")
match (_tokenInfo.Token)
{
- | Keyword ("override") | Keyword ("using")
+ | Keyword ("override")
+
+ => TR.MemberSelect
+
+ | Keyword ("using")
| Operator("|") | Operator(":") => TR.MemberSelect
| _ => TR.None
}
Modified: vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CompilerConcreteDefinitions/IntelliSenseModeTyper.n
==============================================================================
--- vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CompilerConcreteDefinitions/IntelliSenseModeTyper.n (original)
+++ vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CompilerConcreteDefinitions/IntelliSenseModeTyper.n Mon Feb 19 06:04:48 2007
@@ -29,8 +29,12 @@
protected override RunDelayedTypings () : void { /* DO NOTHING */ }
protected override RunSecondPass (meth : MethodBuilder) : void
{
- def t2 = Typer2 (CurrentTypeBuilder, meth);
- t2.Run ();
+ //def t2 = Typer2 (CurrentTypeBuilder, meth);
+ //t2.Run ();
+
+ //def t3 = Typer3 (meth);
+ //t3.Run ();
+
/* DO NOTHING */
}
}
Modified: vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/Engine/CompletionElem.n
==============================================================================
--- vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/Engine/CompletionElem.n (original)
+++ vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/Engine/CompletionElem.n Mon Feb 19 06:04:48 2007
@@ -12,13 +12,25 @@
namespace Nemerle.Completion2
{
- [Record]
+ [Record(Exclude = [_flags])]
public class CompletionElem
{
[Accessor] _glyphType : int;
[Accessor] _displayName : string;
[Accessor] _info : string;
[Accessor] _overloads : SCG.IList[Elem];
+ [Accessor] mutable _flags : CompletionElemFlags;
+
+ public this(
+ glyphType : int,
+ displayName : string,
+ info : string,
+ overloads : SCG.IList[Elem],
+ flags : CompletionElemFlags)
+ {
+ this(glyphType, displayName, info, overloads);
+ _flags = flags;
+ }
public Description : string
{
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 Mon Feb 19 06:04:48 2007
@@ -24,7 +24,7 @@
/*[NotNull]*/ filePath : string,
line : int,
col : int,
- /*[NotNull]*/ source : ISource
+ /*[NotNull]*/ source : ISource,
)
: array[CompletionElem]
{
@@ -191,6 +191,9 @@
}
}
+ if (toks[index] is Keyword("override"))
+ (false, [toks[index]])
+ else
// Get list of completion tokens. It can be situated on the interval
// from colone token to toks[index]. If before toks[index] no
// colon token it is not type enforcement expression.
@@ -198,7 +201,7 @@
}
}
- def completeTypeEnforcement(env, typeExpr : list[Token])
+ def completeTypeEnforcement(env : GlobalEnv, typeExpr : list[Token])
{
// Make fake expression and type it...
//def prefix = "_ : ";
@@ -217,10 +220,43 @@
else MakeCompletionList(result)
}
+ def completeOverrides()
+ {
+ def decl = this.Project.GetActiveDecl(fileIndex, line, col);
+
+ match (decl)
+ {
+ | Type(builder) => // Retrive overrides.
+ match (builder.SuperClass())
+ {
+ | Some(typeInfo) =>
+ def virtMod = NemerleAttributes.VirtualityModifiers & ~NemerleAttributes.New;
+ def allOveerides = typeInfo.GetMembers(SR.BindingFlags.Instance
+ | SR.BindingFlags.NonPublic
+ | SR.BindingFlags.Public).FilterLazy(m => m.Attributes %&& virtMod);
+ def implemented = builder.GetMembers(SR.BindingFlags.Instance
+ | SR.BindingFlags.NonPublic
+ | SR.BindingFlags.Public
+ | SR.BindingFlags.DeclaredOnly).FilterLazy(m =>
+ m.Attributes %&& NemerleAttributes.Override);
+ def canOveeride = allOveerides.ExcludeLazy(implemented);
+ def res = canOveeride.MapToArray(e => CompletionElem(
+ (if (e is IProperty) GlyphType.Property else GlyphType.Method) :> int,
+ e.Name, "info not implemented", null,
+ CompletionElemFlags.ForOverride)).ToArray();
+ res;
+
+ | _ => TopKeywords
+ }
+ | _ => TopKeywords
+ }
+ }
+
def (ok, tokens) = tryGetTypeEnforcementExpressionTokens();
if (ok) completeTypeEnforcement(env, tokens)
- else TopKeywords;
+ else if (tokens is [Keyword("override")]) completeOverrides()
+ else TopKeywords
}
// Callback method. Process completion in expressin.
More information about the svn
mailing list