Author: fejj
Date: 2007-05-11 14:37:43 -0400 (Fri, 11 May 2007)
New Revision: 77246

Modified:
   trunk/monodevelop/Extras/CSharpBinding/ChangeLog
   trunk/monodevelop/Extras/CSharpBinding/Parser/CodeGenerator.cs
Log:
2007-05-11  Jeffrey Stedfast  <[EMAIL PROTECTED]>

        * Parser/CodeGenerator.cs (AddMember): Override default
        implementation so that we can add a statement to throw a
        NotImplementedException.



Modified: trunk/monodevelop/Extras/CSharpBinding/ChangeLog
===================================================================
--- trunk/monodevelop/Extras/CSharpBinding/ChangeLog    2007-05-11 18:34:36 UTC 
(rev 77245)
+++ trunk/monodevelop/Extras/CSharpBinding/ChangeLog    2007-05-11 18:37:43 UTC 
(rev 77246)
@@ -1,3 +1,9 @@
+2007-05-11  Jeffrey Stedfast  <[EMAIL PROTECTED]>
+
+       * Parser/CodeGenerator.cs (AddMember): Override default
+       implementation so that we can add a statement to throw a
+       NotImplementedException.
+
 2007-05-11  Lluis Sanchez Gual <[EMAIL PROTECTED]> 
 
        * CSharpBinding.mds: Added new c# binding solution.

Modified: trunk/monodevelop/Extras/CSharpBinding/Parser/CodeGenerator.cs
===================================================================
--- trunk/monodevelop/Extras/CSharpBinding/Parser/CodeGenerator.cs      
2007-05-11 18:34:36 UTC (rev 77245)
+++ trunk/monodevelop/Extras/CSharpBinding/Parser/CodeGenerator.cs      
2007-05-11 18:37:43 UTC (rev 77246)
@@ -92,6 +92,29 @@
                        return GetGeneratedClass (ctx, file, cls);
                }
                
+               static CodeStatement ThrowNewNotImplementedException ()
+               {
+                       CodeExpression expr = new CodeSnippetExpression ("new 
NotImplementedException ()");
+                       return new CodeThrowExceptionStatement (expr);
+               }
+               
+               public override IMember AddMember (RefactorerContext ctx, 
IClass cls, CodeTypeMember member)
+               {
+                       if (member is CodeMemberProperty) {
+                               CodeMemberProperty prop = (CodeMemberProperty) 
member;
+                               if (prop.HasGet && prop.GetStatements.Count == 
0)
+                                       prop.GetStatements.Add 
(ThrowNewNotImplementedException ());
+                               if (prop.HasSet && prop.SetStatements.Count == 
0)
+                                       prop.SetStatements.Add 
(ThrowNewNotImplementedException ());
+                       } else if (member is CodeMemberMethod) {
+                               CodeMemberMethod method = (CodeMemberMethod) 
member;
+                               if (method.Statements.Count == 0)
+                                       method.Statements.Add 
(ThrowNewNotImplementedException ());
+                       }
+                       
+                       return base.AddMember (ctx, cls, member);
+               }
+               
                public override MemberReferenceCollection FindClassReferences 
(RefactorerContext ctx, string fileName, IClass cls)
                {
                        Resolver resolver = new Resolver (ctx.ParserContext);

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to