Author: lluis
Date: 2008-02-05 12:46:37 -0500 (Tue, 05 Feb 2008)
New Revision: 94911

Modified:
   branches/monodevelop/extras/BooBinding/1.0/BooLanguageBinding.boo
   branches/monodevelop/extras/BooBinding/1.0/ChangeLog
Log:
        * BooLanguageBinding.boo: Added trick to support imports defined 
outside of
          a namespace declaration. Fixes bug #358368.

2008-02-05  Lluis Sanchez Gual <[EMAIL PROTECTED]> 



Modified: branches/monodevelop/extras/BooBinding/1.0/BooLanguageBinding.boo
===================================================================
--- branches/monodevelop/extras/BooBinding/1.0/BooLanguageBinding.boo   
2008-02-05 17:44:31 UTC (rev 94910)
+++ branches/monodevelop/extras/BooBinding/1.0/BooLanguageBinding.boo   
2008-02-05 17:46:37 UTC (rev 94911)
@@ -26,6 +26,7 @@
 import System.Reflection
 import System.Resources
 import System.Xml
+import System.CodeDom
 import System.CodeDom.Compiler;
 import Boo.Lang.CodeDom;
 
@@ -38,7 +39,7 @@
 public class BooLanguageBinding(IDotNetLanguageBinding):
        internal static LanguageName = "Boo"
        compilerServices = BooBindingCompilerServices ()
-       provider = BooCodeProvider ()
+       provider = BooEnhancedCodeProvider ()
        parser = BooBinding.Parser.BooParser ()
        
        public Language as string:
@@ -85,3 +86,19 @@
        public Refactorer as IRefactorer:
                get:
                        return null
+
+public class BooEnhancedCodeProvider (BooCodeProvider):
+       public override def CreateGenerator() as ICodeGenerator:
+               return BooEnhancedCodeGenerator ()
+               
+public class BooEnhancedCodeGenerator (BooCodeGenerator):
+       public override def GenerateCompileUnit (cu as CodeCompileUnit):
+               // Boo doesn't support more than one namespace in a file.
+               // If the compile unit has a default namespace declaration with
+               // only imports on it, merge it with the main namespace
+               if cu.Namespaces.Count == 2 and cu.Namespaces [0].Name == "":
+                       for im in cu.Namespaces[0].Imports:
+                               cu.Namespaces[1].Imports.Add (im)
+                       cu.Namespaces.RemoveAt (0)
+               super.GenerateCompileUnit (cu)
+                               

Modified: branches/monodevelop/extras/BooBinding/1.0/ChangeLog
===================================================================
--- branches/monodevelop/extras/BooBinding/1.0/ChangeLog        2008-02-05 
17:44:31 UTC (rev 94910)
+++ branches/monodevelop/extras/BooBinding/1.0/ChangeLog        2008-02-05 
17:46:37 UTC (rev 94911)
@@ -1,5 +1,10 @@
 2008-02-05  Lluis Sanchez Gual <[EMAIL PROTECTED]> 
 
+       * BooLanguageBinding.boo: Added trick to support imports defined 
outside of
+         a namespace declaration. Fixes bug #358368.
+
+2008-02-05  Lluis Sanchez Gual <[EMAIL PROTECTED]> 
+
        
 
 2008-02-05  Lluis Sanchez Gual <[EMAIL PROTECTED]> 

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

Reply via email to