Author: mhabersack
Date: 2007-12-14 22:42:00 -0500 (Fri, 14 Dec 2007)
New Revision: 91343

Modified:
   trunk/mcs/class/System.Web/System.Web.Compilation/AppCodeCompiler.cs
   trunk/mcs/class/System.Web/System.Web.Compilation/BaseCompiler.cs
   trunk/mcs/class/System.Web/System.Web.Compilation/CachingCompiler.cs
   trunk/mcs/class/System.Web/System.Web.Compilation/ChangeLog
   trunk/mcs/class/System.Web/System.Web.Compilation/WebServiceCompiler.cs
   trunk/mcs/class/System.Web/System.Web.UI/ChangeLog
   trunk/mcs/class/System.Web/System.Web.UI/PageParser.cs
   trunk/mcs/class/System.Web/System.Web.UI/SimpleWebHandlerParser.cs
   trunk/mcs/class/System.Web/System.Web.UI/TemplateControlParser.cs
   trunk/mcs/class/System.Web/System.Web.UI/TemplateParser.cs
Log:
2007-12-15  Marek Habersack  <[EMAIL PROTECTED]>

        * SimpleWebHandlerParser.cs: Default value for Debug is taken from
        the compilation config section.

        * TemplateParser.cs: Added LoadConfigDefaults here, loads default
        value for Debug from the compilation section.
        Cache CompilationConfig in methods where it is accessed more than
        once.
        Default value for Debug in ProcessMainAttributes is taken from the
        compilation config.

        * PageParser.cs, TemplateControlParser.cs: LoadPagesConfigDefaults
        renamed to LoadConfigDefaults.
2007-12-15  Marek Habersack  <[EMAIL PROTECTED]>

        * AppCodeCompiler.cs: do not instantiate CodeDomProvider twice.

        * BaseCompiler.cs: do not use CreateCompiler () in the 2.0
        profile, it's obsoleted. CachingCompiler will use the
        CodeDomProvider methods directly in that case.

        * WebServiceCompiler.cs: Updated GetCompiledType to acquire
        compiler information for the 2.0 profile from system.codeDom.

        * CachingCompiler.cs: the Compile overloads do not use the
        compiler instance, but call appropriate methods on the
        CodeDomProvider instance directly.
        Updated some Compile overloads to acquire compiler information for
        the 2.0 profile from system.codeDom.



Modified: trunk/mcs/class/System.Web/System.Web.Compilation/AppCodeCompiler.cs
===================================================================
--- trunk/mcs/class/System.Web/System.Web.Compilation/AppCodeCompiler.cs        
2007-12-15 02:57:11 UTC (rev 91342)
+++ trunk/mcs/class/System.Web/System.Web.Compilation/AppCodeCompiler.cs        
2007-12-15 03:42:00 UTC (rev 91343)
@@ -205,9 +205,6 @@
                                compilerInfo = CodeDomProvider.GetCompilerInfo 
(compilationSection.DefaultLanguage);
                                if (compilerInfo == null || 
!compilerInfo.IsCodeDomProviderTypeValid)
                                        throw new HttpException ("Internal 
error while initializing application");
-                               provider = compilerInfo.CreateProvider ();
-                               if (provider == null)
-                                       throw new HttpException ("A code 
provider error occurred while initializing application.");
                        }
 
                        provider = compilerInfo.CreateProvider ();

Modified: trunk/mcs/class/System.Web/System.Web.Compilation/BaseCompiler.cs
===================================================================
--- trunk/mcs/class/System.Web/System.Web.Compilation/BaseCompiler.cs   
2007-12-15 02:57:11 UTC (rev 91342)
+++ trunk/mcs/class/System.Web/System.Web.Compilation/BaseCompiler.cs   
2007-12-15 03:42:00 UTC (rev 91343)
@@ -498,15 +498,13 @@
                                // warningLevel or compilerOptions out
                                // of the provider.. they're in the
                                // configuration section, though.
-                       }
-                       else {
+                       } else {
                                Type t = HttpApplication.LoadType (comp.Type, 
true);
                                provider = Activator.CreateInstance (t) as 
CodeDomProvider;
 
                                compilerOptions = comp.CompilerOptions;
                                warningLevel = comp.WarningLevel;
                        }
-
 #else
                        CompilationConfiguration config;
 
@@ -520,8 +518,10 @@
                                throw new HttpException ("Configuration error. 
Language not supported: " +
                                                          lang, 500);
 
+#if !NET_2_0
                        compiler = provider.CreateCompiler ();
-
+#endif
+                       
                        compilerParameters.IncludeDebugInformation = 
parser.Debug;
                        compilerParameters.CompilerOptions = compilerOptions + 
" " + parser.CompilerOptions;
 

Modified: trunk/mcs/class/System.Web/System.Web.Compilation/CachingCompiler.cs
===================================================================
--- trunk/mcs/class/System.Web/System.Web.Compilation/CachingCompiler.cs        
2007-12-15 02:57:11 UTC (rev 91342)
+++ trunk/mcs/class/System.Web/System.Web.Compilation/CachingCompiler.cs        
2007-12-15 03:42:00 UTC (rev 91343)
@@ -91,9 +91,14 @@
                                if (results != null)
                                        return results;
 
+#if NET_2_0
+                               CodeDomProvider comp = compiler.Provider;
+#else
                                ICodeCompiler comp = compiler.Compiler;
-                               GetExtraAssemblies 
(compiler.CompilerParameters);
-                               results = comp.CompileAssemblyFromDom 
(compiler.CompilerParameters, compiler.Unit);
+#endif
+                               CompilerParameters options = 
compiler.CompilerParameters;
+                               GetExtraAssemblies (options);
+                               results = comp.CompileAssemblyFromDom (options, 
compiler.Unit);
                                string [] deps = (string []) 
compiler.Parser.Dependencies.ToArray (typeof (string));
                                cache.Insert (key, results, new CacheDependency 
(deps));
                        } finally {
@@ -122,12 +127,16 @@
                                if (results != null)
                                        return results;
 
-                               SimpleWebHandlerParser parser = compiler.Parser;
+#if NET_2_0
+                               CodeDomProvider comp = compiler.Provider;
+#else
+                               ICodeCompiler comp = compiler.Compiler;
+#endif
                                CompilerParameters options = 
compiler.CompilerOptions;
-                               options.IncludeDebugInformation = parser.Debug;
+
                                GetExtraAssemblies (options);
-                               results = 
compiler.Compiler.CompileAssemblyFromFile (options, compiler.InputFile);
-                               string [] deps = (string []) 
parser.Dependencies.ToArray (typeof (string));
+                               results = comp.CompileAssemblyFromFile 
(options, compiler.InputFile);
+                               string [] deps = (string []) 
compiler.Parser.Dependencies.ToArray (typeof (string));
                                cache.Insert (key, results, new CacheDependency 
(deps));
                        } finally {
                                Monitor.Exit (ticket);
@@ -150,8 +159,7 @@
                        return options;
                }
 
-               public static CompilerResults Compile (string language, string 
key, string file,
-                                                       ArrayList assemblies)
+               public static CompilerResults Compile (string language, string 
key, string file, ArrayList assemblies)
                {
                        Cache cache = HttpRuntime.InternalCache;
                        CompilerResults results = (CompilerResults) cache 
[cachePrefix + key];
@@ -169,21 +177,45 @@
                                results = (CompilerResults) cache [cachePrefix 
+ key];
                                if (results != null)
                                        return results;
- 
+
+                               CodeDomProvider provider = null;
 #if NET_2_0
                                CompilationSection config = 
(CompilationSection) WebConfigurationManager.GetSection 
("system.web/compilation");
-                               Compiler c = config.Compilers[language];
-                               Type t = HttpApplication.LoadType (c.Type, 
true);
-                               CodeDomProvider provider = 
Activator.CreateInstance (t) as CodeDomProvider;
+                               Compiler comp = config.Compilers[language];
+
+                               string compilerOptions = "";
+                               int warningLevel = 0;
+
+                               if (comp == null) {
+                                       CompilerInfo info = 
CodeDomProvider.GetCompilerInfo (language);
+                                       if (info != null && 
info.IsCodeDomProviderTypeValid)
+                                               provider = info.CreateProvider 
();
+
+                                       // XXX there's no way to get
+                                       // warningLevel or compilerOptions out
+                                       // of the provider.. they're in the
+                                       // configuration section, though.
+                               } else {
+                                       Type t = HttpApplication.LoadType 
(comp.Type, true);
+                                       provider = Activator.CreateInstance (t) 
as CodeDomProvider;
+
+                                       compilerOptions = comp.CompilerOptions;
+                                       warningLevel = comp.WarningLevel;
+                               }
 #else
                                CompilationConfiguration config;
                                config = CompilationConfiguration.GetInstance 
(HttpContext.Current);
-                               CodeDomProvider provider = config.GetProvider 
(language);
+                               provider = config.GetProvider (language);
 #endif
                                if (provider == null)
                                        throw new HttpException ("Configuration 
error. Language not supported: " +
                                                                  language, 
500);
+#if !NET_2_0
                                ICodeCompiler compiler = 
provider.CreateCompiler ();
+#else
+                               CodeDomProvider compiler = provider;
+#endif
+                               
                                CompilerParameters options = GetOptions 
(assemblies);
                                TempFileCollection tempcoll = new 
TempFileCollection (config.TempDirectory, true);
                                string dllfilename = Path.GetFileName 
(tempcoll.AddExtension ("dll", true));

Modified: trunk/mcs/class/System.Web/System.Web.Compilation/ChangeLog
===================================================================
--- trunk/mcs/class/System.Web/System.Web.Compilation/ChangeLog 2007-12-15 
02:57:11 UTC (rev 91342)
+++ trunk/mcs/class/System.Web/System.Web.Compilation/ChangeLog 2007-12-15 
03:42:00 UTC (rev 91343)
@@ -1,3 +1,20 @@
+2007-12-15  Marek Habersack  <[EMAIL PROTECTED]>
+
+       * AppCodeCompiler.cs: do not instantiate CodeDomProvider twice.
+
+       * BaseCompiler.cs: do not use CreateCompiler () in the 2.0
+       profile, it's obsoleted. CachingCompiler will use the
+       CodeDomProvider methods directly in that case.
+
+       * WebServiceCompiler.cs: Updated GetCompiledType to acquire
+       compiler information for the 2.0 profile from system.codeDom.
+
+       * CachingCompiler.cs: the Compile overloads do not use the
+       compiler instance, but call appropriate methods on the
+       CodeDomProvider instance directly.
+       Updated some Compile overloads to acquire compiler information for
+       the 2.0 profile from system.codeDom.
+
 2007-12-14  Juraj Skripsky  <[EMAIL PROTECTED]>
 
        * TemplateControlCompiler.cs (AddExpressionAssign):

Modified: 
trunk/mcs/class/System.Web/System.Web.Compilation/WebServiceCompiler.cs
===================================================================
--- trunk/mcs/class/System.Web/System.Web.Compilation/WebServiceCompiler.cs     
2007-12-15 02:57:11 UTC (rev 91342)
+++ trunk/mcs/class/System.Web/System.Web.Compilation/WebServiceCompiler.cs     
2007-12-15 03:42:00 UTC (rev 91343)
@@ -71,10 +71,28 @@
 
                        string lang = parser.Language;
 #if NET_2_0
-                       CompilationSection config = 
(CompilationSection)WebConfigurationManager.GetSection 
("system.web/compilation");
-                       Compiler c = config.Compilers[lang];
-                       Type t = HttpApplication.LoadType (c.Type, true);
-                       provider = Activator.CreateInstance (t) as 
CodeDomProvider;
+                       CompilationSection config = (CompilationSection) 
WebConfigurationManager.GetSection ("system.web/compilation");
+                       Compiler comp = config.Compilers[lang];
+
+                       string compilerOptions = "";
+                       int warningLevel = 0;
+
+                       if (comp == null) {
+                               CompilerInfo info = 
CodeDomProvider.GetCompilerInfo (lang);
+                               if (info != null && 
info.IsCodeDomProviderTypeValid)
+                                       provider = info.CreateProvider ();
+
+                               // XXX there's no way to get
+                               // warningLevel or compilerOptions out
+                               // of the provider.. they're in the
+                               // configuration section, though.
+                       } else {
+                               Type t = HttpApplication.LoadType (comp.Type, 
true);
+                               provider = Activator.CreateInstance (t) as 
CodeDomProvider;
+
+                               compilerOptions = comp.CompilerOptions;
+                               warningLevel = comp.WarningLevel;
+                       }
 #else
                        CompilationConfiguration config;
                        config = CompilationConfiguration.GetInstance 
(parser.Context);
@@ -84,13 +102,15 @@
                                throw new HttpException ("Configuration error. 
Language not supported: " +
                                                          lang, 500);
 
+#if !NET_2_0
                        compiler = provider.CreateCompiler ();
+#endif
 
                        compilerParameters = CachingCompiler.GetOptions 
(parser.Assemblies);
                        compilerParameters.IncludeDebugInformation = 
parser.Debug;
 #if NET_2_0
-                       compilerParameters.CompilerOptions = c.CompilerOptions;
-                       compilerParameters.WarningLevel = c.WarningLevel;
+                       compilerParameters.CompilerOptions = 
comp.CompilerOptions;
+                       compilerParameters.WarningLevel = comp.WarningLevel;
 #else
                        compilerParameters.CompilerOptions = 
config.GetCompilerOptions (lang);
                        compilerParameters.WarningLevel = 
config.GetWarningLevel (lang);

Modified: trunk/mcs/class/System.Web/System.Web.UI/ChangeLog
===================================================================
--- trunk/mcs/class/System.Web/System.Web.UI/ChangeLog  2007-12-15 02:57:11 UTC 
(rev 91342)
+++ trunk/mcs/class/System.Web/System.Web.UI/ChangeLog  2007-12-15 03:42:00 UTC 
(rev 91343)
@@ -1,3 +1,18 @@
+2007-12-15  Marek Habersack  <[EMAIL PROTECTED]>
+
+       * SimpleWebHandlerParser.cs: Default value for Debug is taken from
+       the compilation config section.
+
+       * TemplateParser.cs: Added LoadConfigDefaults here, loads default
+       value for Debug from the compilation section.
+       Cache CompilationConfig in methods where it is accessed more than
+       once.
+       Default value for Debug in ProcessMainAttributes is taken from the
+       compilation config.
+
+       * PageParser.cs, TemplateControlParser.cs: LoadPagesConfigDefaults
+       renamed to LoadConfigDefaults.
+
 2007-12-13  Marek Habersack  <[EMAIL PROTECTED]>
 
        * ClientScriptManager.cs, MasterPageParser.cs, Control.cs,

Modified: trunk/mcs/class/System.Web/System.Web.UI/PageParser.cs
===================================================================
--- trunk/mcs/class/System.Web/System.Web.UI/PageParser.cs      2007-12-15 
02:57:11 UTC (rev 91342)
+++ trunk/mcs/class/System.Web/System.Web.UI/PageParser.cs      2007-12-15 
03:42:00 UTC (rev 91343)
@@ -78,7 +78,7 @@
 
                public PageParser ()
                {
-                       LoadPagesConfigDefaults ();
+                       LoadConfigDefaults ();
                }
                
                internal PageParser (string virtualPath, string inputFile, 
HttpContext context)
@@ -88,7 +88,7 @@
                        InputFile = inputFile;
                        SetBaseType (PagesConfig.PageBaseType);
                        AddApplicationAssembly ();
-                       LoadPagesConfigDefaults ();
+                       LoadConfigDefaults ();
                }
 
 #if NET_2_0
@@ -99,18 +99,18 @@
                        Reader = reader;
                        SetBaseType (PagesConfig.PageBaseType);
                        AddApplicationAssembly ();
-                       LoadPagesConfigDefaults ();
+                       LoadConfigDefaults ();
                }
 #endif
 
-               internal override void LoadPagesConfigDefaults ()
+               internal override void LoadConfigDefaults ()
                {
-                       base.LoadPagesConfigDefaults ();
+                       base.LoadConfigDefaults ();
 #if NET_2_0
                        PagesSection ps = PagesConfig;
 #else
                        PagesConfiguration ps = PagesConfig;
-#endif
+#endif                 
 
                        notBuffer = !ps.Buffer;
                        enableSessionState = ps.EnableSessionState;

Modified: trunk/mcs/class/System.Web/System.Web.UI/SimpleWebHandlerParser.cs
===================================================================
--- trunk/mcs/class/System.Web/System.Web.UI/SimpleWebHandlerParser.cs  
2007-12-15 02:57:11 UTC (rev 91342)
+++ trunk/mcs/class/System.Web/System.Web.UI/SimpleWebHandlerParser.cs  
2007-12-15 03:42:00 UTC (rev 91343)
@@ -240,6 +240,13 @@
 
                internal virtual void AddDefaultDirective (ILocation location, 
TagAttributes attrs)
                {
+#if NET_2_0
+                       CompilationSection compConfig;
+#else
+                       CompilationConfiguration compConfig;
+#endif
+                       compConfig = CompilationConfig;
+                       
                        if (gotDefault)
                                throw new ParseException (location, "duplicate 
" + DefaultDirectiveName + " directive");
 
@@ -254,11 +261,12 @@
                                debug = (String.Compare (d, "true", true) == 0);
                                if (debug == false && String.Compare (d, 
"false", true) != 0)
                                        throw new ParseException (null, 
"Invalid value for Debug attribute");
-                       }
+                       } else
+                               debug = compConfig.Debug;
 
                        language = GetAndRemove (attributes, "language");
                        if (language == null)
-                               language = CompilationConfig.DefaultLanguage;
+                               language = compConfig.DefaultLanguage;
 
                        GetAndRemove (attributes, "codebehind");
                        if (attributes.Count > 0)

Modified: trunk/mcs/class/System.Web/System.Web.UI/TemplateControlParser.cs
===================================================================
--- trunk/mcs/class/System.Web/System.Web.UI/TemplateControlParser.cs   
2007-12-15 02:57:11 UTC (rev 91342)
+++ trunk/mcs/class/System.Web/System.Web.UI/TemplateControlParser.cs   
2007-12-15 03:42:00 UTC (rev 91343)
@@ -57,11 +57,12 @@
 
                protected TemplateControlParser ()
                {
-                       LoadPagesConfigDefaults ();
+                       LoadConfigDefaults ();
                }
                
-               internal virtual void LoadPagesConfigDefaults ()
+               internal override void LoadConfigDefaults ()
                {
+                       base.LoadConfigDefaults ();
 #if NET_2_0
                        PagesSection ps = PagesConfig;
 #else

Modified: trunk/mcs/class/System.Web/System.Web.UI/TemplateParser.cs
===================================================================
--- trunk/mcs/class/System.Web/System.Web.UI/TemplateParser.cs  2007-12-15 
02:57:11 UTC (rev 91342)
+++ trunk/mcs/class/System.Web/System.Web.UI/TemplateParser.cs  2007-12-15 
03:42:00 UTC (rev 91343)
@@ -93,6 +93,8 @@
 
                internal TemplateParser ()
                {
+                       LoadConfigDefaults ();
+                       
                        imports = new ArrayList ();
 #if NET_2_0
                        AddNamespaces (imports);
@@ -114,8 +116,10 @@
 
                        assemblies = new ArrayList ();
 #if NET_2_0
+                       CompilationSection compConfig = CompilationConfig;
+                       
                        bool addAssembliesInBin = false;
-                       foreach (AssemblyInfo info in 
CompilationConfig.Assemblies) {
+                       foreach (AssemblyInfo info in compConfig.Assemblies) {
                                if (info.Assembly == "*")
                                        addAssembliesInBin = true;
                                else
@@ -128,15 +132,22 @@
                                imports.Add (info.Namespace);
                        }
 #else
-                       foreach (string a in CompilationConfig.Assemblies)
+                       CompilationConfiguration compConfig = CompilationConfig;
+                       
+                       foreach (string a in compConfig.Assemblies)
                                AddAssemblyByName (a);
-                       if (CompilationConfig.AssembliesInBin)
+                       if (compConfig.AssembliesInBin)
                                AddAssembliesInBin ();
 #endif
 
-                       language = CompilationConfig.DefaultLanguage;
+                       language = compConfig.DefaultLanguage;
                        implicitLanguage = true;
                }
+
+               internal virtual void LoadConfigDefaults ()
+               {
+                       debug = CompilationConfig.Debug;
+               }
                
                internal void AddApplicationAssembly ()
                {
@@ -515,22 +526,30 @@
                
                internal virtual void ProcessMainAttributes (Hashtable atts)
                {
+#if NET_2_0
+                       CompilationSection compConfig;
+#else
+                       CompilationConfiguration compConfig;
+#endif
+
+                       compConfig = CompilationConfig;
+                       
                        atts.Remove ("Description"); // ignored
 #if NET_1_1
                        atts.Remove ("CodeBehind");  // ignored
 #endif
                        atts.Remove ("AspCompat"); // ignored
                        
-                       debug = GetBool (atts, "Debug", true);
+                       debug = GetBool (atts, "Debug", compConfig.Debug);
                        compilerOptions = GetString (atts, "CompilerOptions", 
"");
                        language = GetString (atts, "Language", "");
                        if (language.Length != 0)
                                implicitLanguage = false;
                        else
-                               language = CompilationConfig.DefaultLanguage;
+                               language = compConfig.DefaultLanguage;
                        
-                       strictOn = GetBool (atts, "Strict", 
CompilationConfig.Strict);
-                       explicitOn = GetBool (atts, "Explicit", 
CompilationConfig.Explicit);
+                       strictOn = GetBool (atts, "Strict", compConfig.Strict);
+                       explicitOn = GetBool (atts, "Explicit", 
compConfig.Explicit);
                        linePragmasOn = GetBool (atts, "LinePragmas", false);
                        
                        string inherits = GetString (atts, "Inherits", null);

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

Reply via email to