Modified:
/nemerle/trunk/VsIntegration/Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/SourceGenerator.n
/nemerle/trunk/VsIntegration/Nemerle.Compiler.Utils/Utils.n
/nemerle/trunk/VsIntegration/Nemerle.VisualStudio/GUI/ImplementMembersForm.cs
=======================================
---
/nemerle/trunk/VsIntegration/Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/SourceGenerator.n
Fri Oct 2 04:19:23 2009
+++
/nemerle/trunk/VsIntegration/Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/SourceGenerator.n
Wed Oct 21 13:57:22 2009
@@ -34,6 +34,11 @@
_writer = writer;
_ns = null;
}
+
+ IsNeedMakeLocation(other : SR.MemberInfo) : bool
+ {
+ _target != null && _target.Equals(other)
+ }
public WriteEventDeclaration(value : IEvent) : void
{
@@ -183,10 +188,10 @@
}
Write(" ");
- when (_target.Equals(value.SystemType))
+ when (_target != null && IsNeedMakeLocation(value.SystemType))
_location = Location(_fileIndex, _line, _column);
WriteType(value);
- when (_target.Equals(value.SystemType))
+ when (_target != null && IsNeedMakeLocation(value.SystemType))
_location = Location(_fileIndex, _location.Line, _location.Column,
_line, _column);
Write(" ");
@@ -280,12 +285,12 @@
{
def name = if (value.MemberKind == MemberKinds.Constructor) "this"
else value.Name;
- when (_target.Equals(value.GetHandle()))
+ when (_target != null && IsNeedMakeLocation(value.GetHandle()))
_location = Location(_fileIndex, _line, _column);
Write(name.Replace('.', '\'').Replace('<', '_').Replace('>', '_'));
- when (_target.Equals(value.GetHandle()))
+ when (_target != null && IsNeedMakeLocation(value.GetHandle()))
_location = Location(_fileIndex, _location.Line, _location.Column,
_line, _column);
}
=======================================
--- /nemerle/trunk/VsIntegration/Nemerle.Compiler.Utils/Utils.n Fri Oct 2
22:57:59 2009
+++ /nemerle/trunk/VsIntegration/Nemerle.Compiler.Utils/Utils.n Wed Oct 21
13:57:22 2009
@@ -20,6 +20,28 @@
public module Utils
{
InvariantCultureCompareInfo : CompareInfo =
CultureInfo.InvariantCulture.CompareInfo;
+
+ public GenerateMemberImplementation(fileIndex : int, member : IMember,
explicit : bool, _accessMods : string, _implName : string) : string
+ {
+ def writer = IO.StringWriter();
+ def generator = SourceGenerator(fileIndex, writer, null);
+
+ if (explicit)
+ {
+ "not impl"
+ }
+ else
+ {
+ match (member)
+ {
+ | method is IMethod =>
generator.WriteMethodDeclaration(method);
+ | prop is IProperty =>
generator.WritePropertyDeclaration(prop);
+ | _ => throw ArgumentException($"Unsupported member type
($member.GetType().Name)", "member");
+ }
+
+ writer.ToString()
+ }
+ }
/// Finds the innermost top level construction (namespace, class,
/// using, attribute) located at fileIndex, line, and col.
=======================================
---
/nemerle/trunk/VsIntegration/Nemerle.VisualStudio/GUI/ImplementMembersForm.cs
Tue Oct 20 11:03:27 2009
+++
/nemerle/trunk/VsIntegration/Nemerle.VisualStudio/GUI/ImplementMembersForm.cs
Wed Oct 21 13:57:22 2009
@@ -169,13 +169,49 @@
});
var res2 = res.ToArray();
+ var sb = new StringBuilder();
foreach (var item in res2)
{
- Debug.WriteLine(item.Key);
+ sb.AppendLine("//" + item.Key + ":");
+
foreach (var item2 in item)
- Debug.WriteLine(" " + item2);
- }
+ {
+
sb.AppendLine(Nemerle.Compiler.Utils.Utils.GenerateMemberImplementation(
+ _source.FileIndex, item2.Member, item2.Explicit,
item2.AccessMods, item2.ImplName));
+
+ }
+ }
+
+ sb.Replace(" { get; set; }", @"
+{
+ get
+ {
+ System.NotImplementedException()
+ }
+ set
+ {
+ _ = value~
+ System.NotImplementedException()
+ }
+}").Replace(" { get; }", @"
+{
+ get
+ {
+ System.NotImplementedException()
+ }
+}").Replace(" { set; }", @"
+{
+ set
+ {
+ System.NotImplementedException()
+ }
+}").Replace(";", @"
+{
+ System.NotImplementedException()
+}").Replace("~", ";");
+
+ Debug.WriteLine(sb.ToString());
}
}
}