Merge pull request #2781 from alexanderkyte/inflated_method_header_leak
[mono.git] / mcs / class / System.Web / System.Web.Compilation / UserControlCompiler.cs
index 80f1191557c5c1baab2f30d688d4f8c85858d22f..cf9aeb6dc824c7ec99b0c1bc20f1aabe97325f69 100644 (file)
@@ -55,21 +55,42 @@ namespace System.Web.Compilation
                                AddOutputCacheAttribute ();
                }
 
-               private void AddOutputCacheAttribute ()
+               protected internal override void CreateMethods ()
+               {
+                       base.CreateMethods ();
+                       CreateProfileProperty ();
+               }
+               
+               void AddOutputCacheAttribute ()
                {
                        CodeAttributeDeclaration cad;
                        cad = new CodeAttributeDeclaration ("System.Web.UI.PartialCachingAttribute");
-                       AddPrimitiveAttribute (cad, parser.OutputCacheDuration);
-                       AddPrimitiveAttribute (cad, parser.OutputCacheVaryByParam);
-                       AddPrimitiveAttribute (cad, parser.OutputCacheVaryByControls);
-                       AddPrimitiveAttribute (cad, parser.OutputCacheVaryByCustom);
-                       AddPrimitiveAttribute (cad, parser.OutputCacheShared);
+                       CodeAttributeArgumentCollection arguments = cad.Arguments;
+                       
+                       AddPrimitiveArgument (arguments, parser.OutputCacheDuration);
+                       AddPrimitiveArgument (arguments, parser.OutputCacheVaryByParam);
+                       AddPrimitiveArgument (arguments, parser.OutputCacheVaryByControls);
+                       AddPrimitiveArgument (arguments, parser.OutputCacheVaryByCustom);
+                       AddPrimitiveArgument (arguments, parser.OutputCacheSqlDependency);
+                       AddPrimitiveArgument (arguments, parser.OutputCacheShared);
+                       arguments.Add (new CodeAttributeArgument ("ProviderName", new CodePrimitiveExpression (parser.ProviderName)));
                        mainClass.CustomAttributes.Add (cad);
                }
 
-               private void AddPrimitiveAttribute (CodeAttributeDeclaration cad, object obj)
+               void AddPrimitiveArgument (CodeAttributeArgumentCollection arguments, object obj)
+               {
+                       arguments.Add (new CodeAttributeArgument (new CodePrimitiveExpression (obj)));
+               }
+
+               protected override void AddStatementsToInitMethodTop (ControlBuilder builder, CodeMemberMethod method)
                {
-                       cad.Arguments.Add (new CodeAttributeArgument (new CodePrimitiveExpression (obj)));
+                       base.AddStatementsToInitMethodTop (builder, method);
+                       if (parser.MasterPageFile != null) {
+                               CodeExpression prop;
+                               prop = new CodePropertyReferenceExpression (new CodeArgumentReferenceExpression("__ctrl"), "MasterPageFile");
+                               CodeExpression ct = new CodePrimitiveExpression (parser.MasterPageFile);
+                               method.Statements.Add (AddLinePragma (new CodeAssignStatement (prop, ct), parser.DirectiveLocation));
+                       }
                }
        }
 }