Преглед на файлове

2008-08-31 Marek Habersack <[email protected]>

	* TemplateParser.cs: added support for the LinePragmas directive
	attribute.

	* ControlBuilder.cs: if this instance is a TemplateBuilder do not
	call MyNamingContainer, so that our own ContainerType can be used
	as the binding container (if present).

2008-08-31  Marek Habersack  <[email protected]>

	* TemplateControlCompiler.cs: trust builder.BindingContainerType
	in the 2.0+ profile - do not use container properties to detect
	the type.
	Added a helper method, compiled only when DEBUG is defined, to
	generate Console.WriteLine CodeDOM calls.

	* BaseCompiler.cs: add line pragmas only if enabled for the
	current file.


svn path=/trunk/mcs/; revision=111983
Marek Habersack преди 17 години
родител
ревизия
27ece7a9b2

+ 4 - 1
mcs/class/System.Web/System.Web.Compilation/BaseCompiler.cs

@@ -101,8 +101,11 @@ namespace System.Web.Compilation
 			return AddLinePragma (statement, location.BeginLine, location.Filename);
 		}
 
-		static bool IgnoreFile (string fileName)
+		bool IgnoreFile (string fileName)
 		{
+			if (parser != null && !parser.LinePragmasOn)
+				return true;
+			
 			return String.Compare (fileName, "@@inner_string@@",
 #if NET_2_0
 					    StringComparison.OrdinalIgnoreCase

+ 11 - 0
mcs/class/System.Web/System.Web.Compilation/ChangeLog

@@ -1,3 +1,14 @@
+2008-08-31  Marek Habersack  <[email protected]>
+
+	* TemplateControlCompiler.cs: trust builder.BindingContainerType
+	in the 2.0+ profile - do not use container properties to detect
+	the type.
+	Added a helper method, compiled only when DEBUG is defined, to
+	generate Console.WriteLine CodeDOM calls.
+
+	* BaseCompiler.cs: add line pragmas only if enabled for the
+	current file.
+
 2008-08-29  Marek Habersack  <[email protected]>
 
 	* AppCodeCompiler.cs: properly handle profile base class

+ 21 - 8
mcs/class/System.Web/System.Web.Compilation/TemplateControlCompiler.cs

@@ -1245,20 +1245,17 @@ namespace System.Web.Compilation
 			return null;
 		}
 
+#if !NET_2_0
 		static string[] containerPropNames = {"Items", "Rows"};
+#endif
 		
 		static Type GetContainerType (ControlBuilder builder)
 		{
-			TemplateBuilder tb = builder as TemplateBuilder;
-			if (tb != null && tb.ContainerType != null)
-				return tb.ContainerType;
-
 			Type type = builder.BindingContainerType;
-
+			
 #if NET_2_0
-			if (typeof (IDataItemContainer).IsAssignableFrom (type))
-				return type;
-#endif
+			return type;
+#else
 			
 			PropertyInfo prop = GetContainerProperty (type, containerPropNames);
 			if (prop == null)
@@ -1273,6 +1270,7 @@ namespace System.Web.Compilation
 				return type;
 
 			return prop.PropertyType;
+#endif
 		}
 		
 		CodeMemberMethod CreateDBMethod (ControlBuilder builder, string name, Type container, Type target)
@@ -2063,6 +2061,21 @@ namespace System.Web.Compilation
 			}
 			return null;
 		}
+
+#if DEBUG
+		CodeMethodInvokeExpression CreateConsoleWriteLineCall (string format, params CodeExpression[] parms)
+		{
+			CodeMethodReferenceExpression cwl = new CodeMethodReferenceExpression (new CodeTypeReferenceExpression (typeof (System.Console)), "WriteLine");
+			CodeMethodInvokeExpression cwlCall = new CodeMethodInvokeExpression (cwl);
+
+			cwlCall.Parameters.Add (new CodePrimitiveExpression (format));
+			if (parms != null && parms.Length > 0)
+				foreach (CodeExpression expr in parms)
+					cwlCall.Parameters.Add (expr);
+
+			return cwlCall;
+		}
+#endif
 	}
 }
 

+ 9 - 0
mcs/class/System.Web/System.Web.UI/ChangeLog

@@ -1,3 +1,12 @@
+2008-08-31  Marek Habersack  <[email protected]>
+
+	* TemplateParser.cs: added support for the LinePragmas directive
+	attribute.
+
+	* ControlBuilder.cs: if this instance is a TemplateBuilder do not
+	call MyNamingContainer, so that our own ContainerType can be used
+	as the binding container (if present).
+
 2008-08-26  Marek Habersack  <[email protected]>
 
 	* TemplateControlParser.cs: added support for the VirtualPath

+ 2 - 2
mcs/class/System.Web/System.Web.UI/ControlBuilder.cs

@@ -180,12 +180,12 @@ namespace System.Web.UI {
 #endif
 		Type BindingContainerType {
 			get {
-				ControlBuilder cb = MyNamingContainer;
+				ControlBuilder cb = (this is TemplateBuilder) ? this : MyNamingContainer;
 				if (cb == null)
 					return typeof (Control);
 
 #if NET_2_0
-				if (cb is ContentBuilderInternal)
+				if (cb != this && cb is ContentBuilderInternal)
 					return cb.BindingContainerType;
 #endif
 

+ 4 - 1
mcs/class/System.Web/System.Web.UI/TemplateParser.cs

@@ -597,7 +597,10 @@ namespace System.Web.UI {
 			
 			strictOn = GetBool (atts, "Strict", compConfig.Strict);
 			explicitOn = GetBool (atts, "Explicit", compConfig.Explicit);
-			linePragmasOn = GetBool (atts, "LinePragmas", false);
+			if (atts.ContainsKey ("LinePragmas"))
+				linePragmasOn = GetBool (atts, "LinePragmas", false);
+			else
+				linePragmasOn = true;
 			
 			string inherits = GetString (atts, "Inherits", null);
 #if NET_2_0