Author: mhabersack
Date: 2008-01-02 15:52:10 -0500 (Wed, 02 Jan 2008)
New Revision: 92125

Modified:
   trunk/mcs/class/System.Web/System.Web.Compilation/AspGenerator.cs
   trunk/mcs/class/System.Web/System.Web.Compilation/BaseCompiler.cs
   trunk/mcs/class/System.Web/System.Web.Compilation/ChangeLog
   trunk/mcs/class/System.Web/System.Web.Compilation/PageCompiler.cs
   trunk/mcs/class/System.Web/System.Web.Compilation/TemplateControlCompiler.cs
   trunk/mcs/class/System.Web/System.Web.Compilation/UserControlCompiler.cs
   trunk/mcs/class/System.Web/System.Web.UI/ChangeLog
   trunk/mcs/class/System.Web/System.Web.UI/TemplateParser.cs
Log:
2008-01-02  Marek Habersack  <[EMAIL PROTECTED]>

        * TemplateParser.cs: added a wrapper class for server-side script
        snippets, to keep track of locations.
        Store main directive location for later use in DirectiveLocation
        internal property.
2008-01-02  Marek Habersack  <[EMAIL PROTECTED]>

        * TemplateControlCompiler.cs: add line pragma wherever necessary.

        * PageCompiler.cs: reorder the statements to match MS.NET output.
        Output line pragma information for directive attributes.

        * BaseCompiler.cs: add a set of AddLinePragma methods for various
        CodeDOM elements. 
        Output line pragmas when adding server-side scripts to the CodeDOM
        tree.

        * AspGenerator.cs: use ServerSideScript to store script location
        in the original file.

        * UserControlCompiler.cs: output line pragmas for the init
        method.


Modified: trunk/mcs/class/System.Web/System.Web.Compilation/AspGenerator.cs
===================================================================
--- trunk/mcs/class/System.Web/System.Web.Compilation/AspGenerator.cs   
2008-01-02 20:02:55 UTC (rev 92124)
+++ trunk/mcs/class/System.Web/System.Web.Compilation/AspGenerator.cs   
2008-01-02 20:52:10 UTC (rev 92125)
@@ -459,8 +459,7 @@
                        string t = text.ToString ();
                        text.Length = 0;
                        if (inScript) {
-                               // TODO: store location
-                               tparser.Scripts.Add (t);
+                               tparser.Scripts.Add (new ServerSideScript (t, 
new System.Web.Compilation.Location (tparser.Location)));
                                return;
                        }
 

Modified: trunk/mcs/class/System.Web/System.Web.Compilation/BaseCompiler.cs
===================================================================
--- trunk/mcs/class/System.Web/System.Web.Compilation/BaseCompiler.cs   
2008-01-02 20:02:55 UTC (rev 92124)
+++ trunk/mcs/class/System.Web/System.Web.Compilation/BaseCompiler.cs   
2008-01-02 20:52:10 UTC (rev 92125)
@@ -69,6 +69,74 @@
                        this.parser = parser;
                }
 
+               internal CodeStatement AddLinePragma (CodeExpression 
expression, ControlBuilder builder)
+               {
+                       return AddLinePragma (new CodeExpressionStatement 
(expression), builder);
+               }
+               
+               internal CodeStatement AddLinePragma (CodeStatement statement, 
ControlBuilder builder)
+               {
+                       if (builder == null || statement == null)
+                               return statement;
+
+                       ILocation location = null;
+
+                       if (!(builder is CodeRenderBuilder))
+                               location = builder.location;
+                       
+                       if (location != null)
+                               return AddLinePragma (statement, location);
+                       else
+                               return AddLinePragma (statement, builder.line, 
builder.fileName);
+               }
+
+               internal CodeStatement AddLinePragma (CodeStatement statement, 
ILocation location)
+               {
+                       if (location == null || statement == null)
+                               return statement;
+                       
+                       return AddLinePragma (statement, location.BeginLine, 
location.Filename);
+               }
+
+               internal CodeStatement AddLinePragma (CodeStatement statement, 
int line, string fileName)
+               {
+                       if (statement == null)
+                               return null;
+                       
+                       statement.LinePragma = new CodeLinePragma (fileName, 
line);
+                       return statement;                       
+               }
+
+               internal CodeTypeMember AddLinePragma (CodeTypeMember member, 
ControlBuilder builder)
+               {
+                       if (builder == null || member == null)
+                               return member;
+
+                       ILocation location = builder.location;
+                       
+                       if (location != null)
+                               return AddLinePragma (member, location);
+                       else
+                               return AddLinePragma (member, builder.line, 
builder.fileName);
+               }
+               
+               internal CodeTypeMember AddLinePragma (CodeTypeMember member, 
ILocation location)
+               {
+                       if (location == null || member == null)
+                               return member;
+
+                       return AddLinePragma (member, location.BeginLine, 
location.Filename);
+               }
+               
+               internal CodeTypeMember AddLinePragma (CodeTypeMember member, 
int line, string fileName)
+               {
+                       if (member == null)
+                               return null;
+                       
+                       member.LinePragma = new CodeLinePragma (fileName, line);
+                       return member;
+               }
+               
                void Init ()
                {
                        unit = new CodeCompileUnit ();
@@ -271,9 +339,15 @@
                        if (parser.Scripts == null || parser.Scripts.Count == 0)
                                return;
 
+                       ServerSideScript sss;
+                       
                        foreach (object o in parser.Scripts) {
-                               if (o is string)
-                                       mainClass.Members.Add (new 
CodeSnippetTypeMember ((string) o));
+                               sss = o as ServerSideScript;
+
+                               if (sss == null)
+                                       continue;
+                               
+                               mainClass.Members.Add (AddLinePragma (new 
CodeSnippetTypeMember (sss.Script), sss.Location));
                        }
                }
                

Modified: trunk/mcs/class/System.Web/System.Web.Compilation/ChangeLog
===================================================================
--- trunk/mcs/class/System.Web/System.Web.Compilation/ChangeLog 2008-01-02 
20:02:55 UTC (rev 92124)
+++ trunk/mcs/class/System.Web/System.Web.Compilation/ChangeLog 2008-01-02 
20:52:10 UTC (rev 92125)
@@ -1,3 +1,21 @@
+2008-01-02  Marek Habersack  <[EMAIL PROTECTED]>
+
+       * TemplateControlCompiler.cs: add line pragma wherever necessary.
+
+       * PageCompiler.cs: reorder the statements to match MS.NET output.
+       Output line pragma information for directive attributes.
+
+       * BaseCompiler.cs: add a set of AddLinePragma methods for various
+       CodeDOM elements. 
+       Output line pragmas when adding server-side scripts to the CodeDOM
+       tree.
+
+       * AspGenerator.cs: use ServerSideScript to store script location
+       in the original file.
+
+       * UserControlCompiler.cs: output line pragmas for the init
+       method.
+
 2007-12-28  Marek Habersack  <[EMAIL PROTECTED]>
 
        * PageCompiler.cs: MS.NET compatibility: added the

Modified: trunk/mcs/class/System.Web/System.Web.Compilation/PageCompiler.cs
===================================================================
--- trunk/mcs/class/System.Web/System.Web.Compilation/PageCompiler.cs   
2008-01-02 20:02:55 UTC (rev 92124)
+++ trunk/mcs/class/System.Web/System.Web.Compilation/PageCompiler.cs   
2008-01-02 20:52:10 UTC (rev 92125)
@@ -185,28 +185,30 @@
                protected override void AddStatementsToInitMethod 
(CodeMemberMethod method)
                {
 #if NET_2_0
-                       CodeMethodInvokeExpression expr = new 
CodeMethodInvokeExpression (thisRef, "InitializeCulture");
-                       method.Statements.Add (new CodeExpressionStatement 
(expr));
-
+                       ILocation directiveLocation = 
pageParser.DirectiveLocation;
+                       
                        CodeArgumentReferenceExpression ctrlVar = new 
CodeArgumentReferenceExpression("__ctrl");
                        if (pageParser.Title != null)
-                               method.Statements.Add (CreatePropertyAssign 
(ctrlVar, "Title", pageParser.Title));
+                               method.Statements.Add (AddLinePragma 
(CreatePropertyAssign (ctrlVar, "Title", pageParser.Title), directiveLocation));
 
                        if (pageParser.MasterPageFile != null)
-                               method.Statements.Add (CreatePropertyAssign 
(ctrlVar, "MasterPageFile", pageParser.MasterPageFile));
+                               method.Statements.Add (AddLinePragma 
(CreatePropertyAssign (ctrlVar, "MasterPageFile", pageParser.MasterPageFile), 
directiveLocation));
 
                        if (pageParser.Theme != null)
-                               method.Statements.Add (CreatePropertyAssign 
(ctrlVar, "Theme", pageParser.Theme));
+                               method.Statements.Add (AddLinePragma 
(CreatePropertyAssign (ctrlVar, "Theme", pageParser.Theme), directiveLocation));
 
                        if (pageParser.StyleSheetTheme != null)
-                               method.Statements.Add (CreatePropertyAssign 
(ctrlVar, "StyleSheetTheme", pageParser.StyleSheetTheme));
+                               method.Statements.Add (AddLinePragma 
(CreatePropertyAssign (ctrlVar, "StyleSheetTheme", pageParser.StyleSheetTheme), 
directiveLocation));
 
                        if (pageParser.Async != false)
-                               method.Statements.Add (CreatePropertyAssign 
(ctrlVar, "AsyncMode", pageParser.Async));
+                               method.Statements.Add (AddLinePragma 
(CreatePropertyAssign (ctrlVar, "AsyncMode", pageParser.Async), 
directiveLocation));
 
                        if (pageParser.AsyncTimeout != -1)
-                               method.Statements.Add (CreatePropertyAssign 
(ctrlVar, "AsyncTimeout",
-                                                                            
TimeSpan.FromSeconds (pageParser.AsyncTimeout)));
+                               method.Statements.Add (AddLinePragma 
(CreatePropertyAssign (ctrlVar, "AsyncTimeout",
+                                                                               
            TimeSpan.FromSeconds (pageParser.AsyncTimeout)), 
directiveLocation));
+
+                       CodeMethodInvokeExpression expr = new 
CodeMethodInvokeExpression (thisRef, "InitializeCulture");
+                       method.Statements.Add (AddLinePragma (new 
CodeExpressionStatement (expr), directiveLocation));
 #endif
                }
 

Modified: 
trunk/mcs/class/System.Web/System.Web.Compilation/TemplateControlCompiler.cs
===================================================================
--- 
trunk/mcs/class/System.Web/System.Web.Compilation/TemplateControlCompiler.cs    
    2008-01-02 20:02:55 UTC (rev 92124)
+++ 
trunk/mcs/class/System.Web/System.Web.Compilation/TemplateControlCompiler.cs    
    2008-01-02 20:52:10 UTC (rev 92125)
@@ -57,7 +57,7 @@
 
                TemplateControlParser parser;
                int dataBoundAtts;
-               ILocation currentLocation;
+               internal ILocation currentLocation;
 
                static TypeConverter colorConverter;
 
@@ -81,7 +81,7 @@
                }
 
                void CreateField (ControlBuilder builder, bool check)
-               {                       
+               {
                        if (builder == null || builder.ID == null || 
builder.ControlType == null)
                                return;
 #if NET_2_0
@@ -101,10 +101,10 @@
                        field.Type.Options |= 
CodeTypeReferenceOptions.GlobalReference;
 
                        if (partialClass != null)
-                               partialClass.Members.Add (field);
+                               partialClass.Members.Add (AddLinePragma (field, 
builder));
                        else
 #endif
-                               mainClass.Members.Add (field);
+                               mainClass.Members.Add (AddLinePragma (field, 
builder));
                }
 
                bool CheckBaseFieldOrProperty (string id, Type type, ref 
MemberAttributes ma)
@@ -140,7 +140,7 @@
 
                        return true;
                }
-
+               
                void AddParsedSubObjectStmt (ControlBuilder builder, 
CodeExpression expr) 
                {
                        if (!builder.haveParserVariable) {
@@ -155,11 +155,13 @@
                        CodeVariableReferenceExpression var = new 
CodeVariableReferenceExpression ("__parser");
                        CodeMethodInvokeExpression invoke = new 
CodeMethodInvokeExpression (var, "AddParsedSubObject");
                        invoke.Parameters.Add (expr);
-                       builder.methodStatements.Add (invoke);
+                       builder.methodStatements.Add (AddLinePragma (invoke, 
builder));
                }
-
+               
                void InitMethod (ControlBuilder builder, bool isTemplate, bool 
childrenAsProperties)
                {
+                       currentLocation = builder.location;
+                       
                        string tailname = ((builder is RootBuilder) ? "Tree" : 
("_" + builder.ID));
                        CodeMemberMethod method = new CodeMemberMethod ();
                        builder.method = method;
@@ -231,8 +233,8 @@
                                CodeAssignStatement assign = new 
CodeAssignStatement ();
                                assign.Left = ctrlVar;
                                assign.Right = newExpr;
-                               method.Statements.Add (assign);
-                               
+                               method.Statements.Add (AddLinePragma (assign, 
builder));
+                                                               
                                // this.$builderID = _ctrl;
                                //
                                CodeFieldReferenceExpression builderID = new 
CodeFieldReferenceExpression ();
@@ -241,7 +243,8 @@
                                assign = new CodeAssignStatement ();
                                assign.Left = builderID;
                                assign.Right = ctrlVar;
-                               method.Statements.Add (assign);
+                               method.Statements.Add (AddLinePragma (assign, 
builder));
+
                                if (typeof (UserControl).IsAssignableFrom 
(type)) {
                                        CodeMethodReferenceExpression mref = 
new CodeMethodReferenceExpression ();
                                        mref.TargetObject = builderID;
@@ -419,7 +422,7 @@
 
                                CodeMethodInvokeExpression expr;
                                expr = new CodeMethodInvokeExpression 
(methodRef, new CodePrimitiveExpression (str));
-                               builder.renderMethod.Statements.Add (expr);
+                               builder.renderMethod.Statements.Add 
(AddLinePragma (expr, builder));
                        }
                }
 
@@ -446,7 +449,7 @@
                                }
                        }
 #endif
-                       method = CreateDBMethod (dbMethodName, GetContainerType 
(builder), builder.ControlType);
+                       method = CreateDBMethod (builder, dbMethodName, 
GetContainerType (builder), builder.ControlType);
                        
                        CodeVariableReferenceExpression targetExpr = new 
CodeVariableReferenceExpression ("target");
 
@@ -488,12 +491,12 @@
                        bool isWritable = IsWritablePropertyOrField (member);
                        if (isDataBound && isWritable) {
                                string dbMethodName = DataBoundProperty 
(builder, type, var_name, att);
-                               AddEventAssign (method, "DataBinding", typeof 
(EventHandler), dbMethodName);
+                               AddEventAssign (method, builder, "DataBinding", 
typeof (EventHandler), dbMethodName);
                                return;
                        }
 #if NET_2_0
                        else if (isExpression && isWritable) {
-                               AddExpressionAssign (method, member, type, 
var_name, att);
+                               AddExpressionAssign (method, builder, member, 
type, var_name, att);
                                return;
                        }
 #endif
@@ -503,7 +506,7 @@
                        currentLocation = builder.location;
                        assign.Right = GetExpressionFromString (type, att, 
member);
 
-                       method.Statements.Add (assign);
+                       method.Statements.Add (AddLinePragma (assign, builder));
                }
 
                bool IsDataBound (string value)
@@ -664,7 +667,7 @@
                }
 
 #if NET_2_0
-               void AddExpressionAssign (CodeMemberMethod method, MemberInfo 
member, Type type, string name, string value)
+               void AddExpressionAssign (CodeMemberMethod method, 
ControlBuilder builder, MemberInfo member, Type type, string name, string value)
                {
                        CodeAssignStatement assign = new CodeAssignStatement ();
                        assign.Left = new CodePropertyReferenceExpression 
(ctrlVar, name);
@@ -721,7 +724,7 @@
                        BoundPropertyEntry bpe = CreateBoundPropertyEntry 
(member as PropertyInfo, prefix, expr);
                        assign.Right = eb.GetCodeExpression (bpe, parsedData, 
ctx);
                        
-                       method.Statements.Add (assign);
+                       builder.method.Statements.Add (AddLinePragma (assign, 
builder));
                }
 
                BoundPropertyEntry CreateBoundPropertyEntry (PropertyInfo pi, 
string prefix, string expr)
@@ -740,7 +743,7 @@
                        return ret;
                }
                
-               void AssignPropertyFromResources (CodeMemberMethod method, 
MemberInfo mi, string attvalue)
+               void AssignPropertyFromResources (ControlBuilder builder, 
MemberInfo mi, string attvalue)
                {
                        bool isProperty = mi.MemberType == MemberTypes.Property;
                        bool isField = !isProperty && (mi.MemberType == 
MemberTypes.Field);
@@ -777,10 +780,10 @@
                        assign.Left = new CodePropertyReferenceExpression 
(ctrlVar, memberName);
                        assign.Right = 
ResourceExpressionBuilder.CreateGetLocalResourceObject (mi, resname);
                        
-                       method.Statements.Add (assign);
+                       builder.method.Statements.Add (AddLinePragma (assign, 
builder));
                }
 
-               void AssignPropertiesFromResources (CodeMemberMethod method, 
Type controlType, string attvalue)
+               void AssignPropertiesFromResources (ControlBuilder builder, 
Type controlType, string attvalue)
                {
                        // Process all public fields and properties of the 
control. We don't use GetMembers to make the code
                        // faster
@@ -792,9 +795,9 @@
                                BindingFlags.Public | 
BindingFlags.FlattenHierarchy);
 
                        foreach (FieldInfo fi in fields)
-                               AssignPropertyFromResources (method, fi, 
attvalue);
+                               AssignPropertyFromResources (builder, fi, 
attvalue);
                        foreach (PropertyInfo pi in properties)
-                               AssignPropertyFromResources (method, pi, 
attvalue);
+                               AssignPropertyFromResources (builder, pi, 
attvalue);
                }
                
                void AssignPropertiesFromResources (ControlBuilder builder, 
string attvalue)
@@ -806,11 +809,11 @@
                        if (controlType == null)
                                return;
 
-                       AssignPropertiesFromResources (builder.method, 
controlType, attvalue);
+                       AssignPropertiesFromResources (builder, controlType, 
attvalue);
                }
 #endif
                
-               void AddEventAssign (CodeMemberMethod method, string name, Type 
type, string value)
+               void AddEventAssign (CodeMemberMethod method, ControlBuilder 
builder, string name, Type type, string value)
                {
                        //"__ctrl.{0} += new {1} (this.{2});"
                        CodeEventReferenceExpression evtID = new 
CodeEventReferenceExpression (ctrlVar, name);
@@ -836,6 +839,7 @@
                                foreach (EventInfo ev in ev_info){
                                        if (InvariantCompareNoCase (ev.Name, 
id_as_event)){
                                                AddEventAssign (builder.method,
+                                                               builder,
                                                                ev.Name,
                                                                
ev.EventHandlerType,
                                                                attvalue);
@@ -885,7 +889,7 @@
                                expr = new CodeMethodInvokeExpression 
(methodExpr);
                                expr.Parameters.Add (new 
CodePrimitiveExpression (id));
                                expr.Parameters.Add (new 
CodePrimitiveExpression (attvalue));
-                               method.Statements.Add (expr);
+                               method.Statements.Add (AddLinePragma (expr, 
builder));
                        }
 
                }
@@ -933,9 +937,9 @@
                        string id = builder.GetNextID (null);
                        string dbMethodName = "__DataBind_" + id;
                        CodeMemberMethod method = builder.method;
-                       AddEventAssign (method, "DataBinding", typeof 
(EventHandler), dbMethodName);
+                       AddEventAssign (method, builder, "DataBinding", typeof 
(EventHandler), dbMethodName);
 
-                       method = CreateDBMethod (dbMethodName, GetContainerType 
(builder), builder.ControlType);
+                       method = CreateDBMethod (builder, dbMethodName, 
GetContainerType (builder), builder.ControlType);
                        CodeCastExpression cast;
                        CodeMethodReferenceExpression methodExpr;
                        CodeMethodInvokeExpression expr;
@@ -974,6 +978,7 @@
                {
                        if (parent == null || child == null)
                                return;
+                       
                        CodeMethodReferenceExpression m = new 
CodeMethodReferenceExpression (thisRef, child.method.Name);
                        CodeMethodInvokeExpression expr = new 
CodeMethodInvokeExpression (m);
 
@@ -1001,8 +1006,8 @@
                                build.Parameters.Add (new 
CodeDelegateCreateExpression (
                                                              new 
CodeTypeReference (typeof (System.Web.UI.BuildMethod)),
                                                              thisRef, 
child.method.Name));
-                               
-                               parent.methodStatements.Add (build);
+
+                               parent.methodStatements.Add (AddLinePragma 
(build, parent));
                                if (parent.HasAspCode)
                                        AddRenderControl (parent);
                                return;
@@ -1010,18 +1015,18 @@
                                 
                        if (child.isProperty || parent.ChildrenAsProperties) {
                                expr.Parameters.Add (new 
CodeFieldReferenceExpression (ctrlVar, child.TagName));
-                               parent.methodStatements.Add (expr);
+                               parent.methodStatements.Add (AddLinePragma 
(expr, parent));
                                return;
                        }
 
-                       parent.methodStatements.Add (expr);
+                       parent.methodStatements.Add (AddLinePragma (expr, 
parent));
                        CodeFieldReferenceExpression field = new 
CodeFieldReferenceExpression (thisRef, child.ID);
-                       if (parent.ControlType == null || typeof 
(IParserAccessor).IsAssignableFrom (parent.ControlType)) {
+                       if (parent.ControlType == null || typeof 
(IParserAccessor).IsAssignableFrom (parent.ControlType))
                                AddParsedSubObjectStmt (parent, field);
-                       } else {
+                       else {
                                CodeMethodInvokeExpression invoke = new 
CodeMethodInvokeExpression (ctrlVar, "Add");
                                invoke.Parameters.Add (field);
-                               parent.methodStatements.Add (invoke);
+                               parent.methodStatements.Add (AddLinePragma 
(invoke, parent));
                        }
                                
                        if (parent.HasAspCode)
@@ -1133,7 +1138,7 @@
                        invoke.Parameters.Add (new CodePrimitiveExpression 
(cbuilder.ContentPlaceHolderID));
                        invoke.Parameters.Add (newCompiled);
 
-                       method.Statements.Add (invoke);
+                       method.Statements.Add (AddLinePragma (invoke, 
cbuilder));
                }
 #endif
 
@@ -1144,7 +1149,7 @@
 
                        if (!cr.IsAssign) {
                                CodeSnippetStatement code = new 
CodeSnippetStatement (cr.Code);
-                               parent.renderMethod.Statements.Add (code);
+                               parent.renderMethod.Statements.Add 
(AddLinePragma (code, cr));
                                return;
                        }
 
@@ -1154,7 +1159,7 @@
                                                        "Write");
 
                        expr.Parameters.Add (new CodeSnippetExpression 
(cr.Code));
-                       parent.renderMethod.Statements.Add (expr);
+                       parent.renderMethod.Statements.Add (AddLinePragma 
(expr, cr));
                }
 
                static Type GetContainerType (ControlBuilder builder)
@@ -1183,7 +1188,7 @@
 #endif
                }
                
-               CodeMemberMethod CreateDBMethod (string name, Type container, 
Type target)
+               CodeMemberMethod CreateDBMethod (ControlBuilder builder, string 
name, Type container, Type target)
                {
                        CodeMemberMethod method = new CodeMemberMethod ();
                        method.Attributes = MemberAttributes.Public | 
MemberAttributes.Final;
@@ -1198,7 +1203,7 @@
                        decl.Name = "Container";
                        decl.Type = containerRef;
                        method.Statements.Add (decl);
-
+                       
                        decl = new CodeVariableDeclarationStatement();
                        decl.Name = "target";
                        decl.Type = targetRef;
@@ -1208,13 +1213,13 @@
                        CodeAssignStatement assign = new CodeAssignStatement ();
                        assign.Left = targetExpr;
                        assign.Right = new CodeCastExpression (targetRef, new 
CodeArgumentReferenceExpression ("sender"));
-                       method.Statements.Add (assign);
+                       method.Statements.Add (AddLinePragma (assign, builder));
 
                        assign = new CodeAssignStatement ();
                        assign.Left = new CodeVariableReferenceExpression 
("Container");
                        assign.Right = new CodeCastExpression (containerRef,
                                                new 
CodePropertyReferenceExpression (targetExpr, "BindingContainer"));
-                       method.Statements.Add (assign);
+                       method.Statements.Add (AddLinePragma (assign, builder));
 
                        return method;
                }
@@ -1231,11 +1236,11 @@
                        // Add the method that builds the 
DataBoundLiteralControl
                        InitMethod (db, false, false);
                        CodeMemberMethod method = db.method;
-                       AddEventAssign (method, "DataBinding", typeof 
(EventHandler), dbMethodName);
+                       AddEventAssign (method, builder, "DataBinding", typeof 
(EventHandler), dbMethodName);
                        method.Statements.Add (new CodeMethodReturnStatement 
(ctrlVar));
 
                        // Add the DataBind handler
-                       method = CreateDBMethod (dbMethodName, GetContainerType 
(builder), typeof (DataBoundLiteralControl));
+                       method = CreateDBMethod (builder, dbMethodName, 
GetContainerType (builder), typeof (DataBoundLiteralControl));
 
                        CodeVariableReferenceExpression targetExpr = new 
CodeVariableReferenceExpression ("target");
                        CodeMethodInvokeExpression invoke = new 
CodeMethodInvokeExpression ();
@@ -1248,7 +1253,7 @@
                                                        "ToString");
                        tostring.Parameters.Add (new CodeSnippetExpression 
(db.Code));
                        invoke.Parameters.Add (tostring);
-                       method.Statements.Add (invoke);
+                       method.Statements.Add (AddLinePragma (invoke, builder));
                        
                        mainClass.Members.Add (method);
 
@@ -1329,7 +1334,7 @@
                                                        CodeAssignStatement 
assign = new CodeAssignStatement ();
                                                        assign.Left = new 
CodePropertyReferenceExpression (ctrlVar, pb.PropertyName);
                                                        assign.Right = new 
CodePrimitiveExpression (asb.ToString ());
-                                                       method.Statements.Add 
(assign);
+                                                       method.Statements.Add 
(AddLinePragma (assign, builder));
                                                }
                                                continue;
                                        }
@@ -1418,7 +1423,7 @@
 #if NET_2_0
                        if (builder is RootBuilder)
                                if (!String.IsNullOrEmpty 
(parser.MetaResourceKey))
-                                       AssignPropertiesFromResources 
(builder.method, parser.BaseType, parser.MetaResourceKey);
+                                       AssignPropertiesFromResources (builder, 
parser.BaseType, parser.MetaResourceKey);
 #endif
                }
                

Modified: 
trunk/mcs/class/System.Web/System.Web.Compilation/UserControlCompiler.cs
===================================================================
--- trunk/mcs/class/System.Web/System.Web.Compilation/UserControlCompiler.cs    
2008-01-02 20:02:55 UTC (rev 92124)
+++ trunk/mcs/class/System.Web/System.Web.Compilation/UserControlCompiler.cs    
2008-01-02 20:52:10 UTC (rev 92125)
@@ -87,7 +87,7 @@
                                CodeExpression prop;
                                prop = new CodePropertyReferenceExpression (new 
CodeArgumentReferenceExpression("__ctrl"), "MasterPageFile");
                                CodeExpression ct = new CodePrimitiveExpression 
(parser.MasterPageFile);
-                               method.Statements.Add (new CodeAssignStatement 
(prop, ct));
+                               method.Statements.Add (AddLinePragma (new 
CodeAssignStatement (prop, ct), parser.DirectiveLocation));
                        }
 #endif
                }

Modified: trunk/mcs/class/System.Web/System.Web.UI/ChangeLog
===================================================================
--- trunk/mcs/class/System.Web/System.Web.UI/ChangeLog  2008-01-02 20:02:55 UTC 
(rev 92124)
+++ trunk/mcs/class/System.Web/System.Web.UI/ChangeLog  2008-01-02 20:52:10 UTC 
(rev 92125)
@@ -1,3 +1,10 @@
+2008-01-02  Marek Habersack  <[EMAIL PROTECTED]>
+
+       * TemplateParser.cs: added a wrapper class for server-side script
+       snippets, to keep track of locations.
+       Store main directive location for later use in DirectiveLocation
+       internal property.
+
 2008-01-01 Igor Zelmanovich <[EMAIL PROTECTED]>
 
        * Page.cs:

Modified: trunk/mcs/class/System.Web/System.Web.UI/TemplateParser.cs
===================================================================
--- trunk/mcs/class/System.Web/System.Web.UI/TemplateParser.cs  2008-01-02 
20:02:55 UTC (rev 92124)
+++ trunk/mcs/class/System.Web/System.Web.UI/TemplateParser.cs  2008-01-02 
20:52:10 UTC (rev 92125)
@@ -44,7 +44,18 @@
 #endif
 
 namespace System.Web.UI {
-
+       internal class ServerSideScript
+       {
+               public readonly string Script;
+               public readonly ILocation Location;
+               
+               public ServerSideScript (string script, ILocation location)
+               {
+                       Script = script;
+                       Location = location;
+               }
+       }
+       
        // CAS
        [AspNetHostingPermission (SecurityAction.LinkDemand, Level = 
AspNetHostingPermissionLevel.Minimal)]
        [AspNetHostingPermission (SecurityAction.InheritanceDemand, Level = 
AspNetHostingPermissionLevel.Minimal)]
@@ -88,6 +99,8 @@
                Type codeFileBaseClassType;
                List <UnknownAttributeDescriptor> unknownMainAttributes;
 #endif
+               ILocation directiveLocation;
+               
                Assembly srcAssembly;
                int appAssemblyIndex = -1;
 
@@ -526,6 +539,8 @@
                
                internal virtual void ProcessMainAttributes (Hashtable atts)
                {
+                       directiveLocation = new System.Web.Compilation.Location 
(Location);
+                       
 #if NET_2_0
                        CompilationSection compConfig;
 #else
@@ -800,6 +815,10 @@
                internal abstract string DefaultBaseTypeName { get; }
                internal abstract string DefaultDirectiveName { get; }
 
+               internal ILocation DirectiveLocation {
+                       get { return directiveLocation; }
+               }
+               
                internal string InputFile
                {
                        get { return inputFile; }

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

Reply via email to