[asp.net] Ignore JavaScript blocks enclosed in HTML comments
[mono.git] / mcs / class / System.Web / System.Web.Compilation / UserControlBuildProvider.cs
index bb4aa373d1a1b055371371ac5c75d18a1b0f1fc1..fe5d3298cf294138975daadcc695594b61dd8ffb 100644 (file)
@@ -28,7 +28,6 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
-#if NET_2_0
 
 using System;
 using System.CodeDom;
@@ -39,48 +38,27 @@ using System.Reflection;
 using System.Web.UI;
 
 namespace System.Web.Compilation {
-
-       sealed class UserControlBuildProvider : BuildProvider {
-               UserControlCompiler uccompiler;
-               CompilerType compiler_type;
-
+       [BuildProviderAppliesTo (BuildProviderAppliesTo.Web)]
+       sealed class UserControlBuildProvider : TemplateBuildProvider {
                public UserControlBuildProvider ()
                {
                }
 
-               public override void GenerateCode (AssemblyBuilder assemblyBuilder)
-               {
-                       HttpContext context = HttpContext.Current;
-                       UserControlParser parser = new UserControlParser (VirtualPath, OpenReader (), context);
-                       uccompiler = new UserControlCompiler (parser);
-                       uccompiler.CreateMethods ();
-                       compiler_type = GetDefaultCompilerTypeForLanguage (parser.Language);
-                       using (TextWriter writer = assemblyBuilder.CreateCodeFile (this)) {
-                               CodeDomProvider provider = uccompiler.Provider;
-                               CodeCompileUnit unit = uccompiler.CompileUnit;
-                               provider.CreateGenerator().GenerateCodeFromCompileUnit (unit, writer, null);
-                       }
-               }
-
-               public override Type GetGeneratedType (CompilerResults results)
+               protected override BaseCompiler CreateCompiler (TemplateParser parser)
                {
-                       // This is not called if compilation failed.
-                       // Returning null makes the caller throw an InvalidCastException
-                       Assembly assembly = results.CompiledAssembly;
-                       return assembly.GetType (uccompiler.Parser.ClassName);
+                       return new UserControlCompiler (parser as UserControlParser);
                }
 
-               public override CompilerType CodeCompilerType {
-                       get { return compiler_type; }
+               protected override TemplateParser CreateParser (VirtualPath virtualPath, string physicalPath, HttpContext context)
+               {       
+                       return CreateParser (virtualPath, physicalPath, OpenReader (virtualPath.Original), context);
                }
-
-               // FIXME: figure this out.
-               public override ICollection VirtualPathDependencies {
-                       get {
-                               return uccompiler.Parser.Dependencies;
-                       }
+               
+               protected override TemplateParser CreateParser (VirtualPath virtualPath, string physicalPath, TextReader reader, HttpContext context)
+               {
+                       return new UserControlParser (virtualPath, physicalPath, reader, context);
                }
        }
 }
-#endif
+