Author: mhabersack
Date: 2007-03-26 06:56:44 -0500 (Mon, 26 Mar 2007)
New Revision: 74973
Modified:
trunk/mcs/class/System.Web/System.Web.Compilation/ChangeLog
trunk/mcs/class/System.Web/System.Web.Compilation/TemplateControlCompiler.cs
Log:
2007-03-26 Marek Habersack <[EMAIL PROTECTED]>
Process meta:resourcekey after all the field/attribute assignments
are done. Fixes bug #80809.
Clean the code up a bit.
Modified: trunk/mcs/class/System.Web/System.Web.Compilation/ChangeLog
===================================================================
--- trunk/mcs/class/System.Web/System.Web.Compilation/ChangeLog 2007-03-26
11:42:01 UTC (rev 74972)
+++ trunk/mcs/class/System.Web/System.Web.Compilation/ChangeLog 2007-03-26
11:56:44 UTC (rev 74973)
@@ -3,6 +3,9 @@
* TemplateControlCompiler.cs: refactor assining properties from
resources a bit to support pages and user controls. Fixes bug
#81204.
+ Process meta:resourcekey after all the field/attribute assignments
+ are done. Fixes bug #80809.
+ Clean the code up a bit.
2007-03-21 Marek Habersack <[EMAIL PROTECTED]>
Modified:
trunk/mcs/class/System.Web/System.Web.Compilation/TemplateControlCompiler.cs
===================================================================
---
trunk/mcs/class/System.Web/System.Web.Compilation/TemplateControlCompiler.cs
2007-03-26 11:42:01 UTC (rev 74972)
+++
trunk/mcs/class/System.Web/System.Web.Compilation/TemplateControlCompiler.cs
2007-03-26 11:56:44 UTC (rev 74973)
@@ -705,7 +705,7 @@
method.Statements.Add (assign);
}
- void AssignPropertyFromResources (CodeMemberMethod method,
MemberInfo mi, string attvalue, string varname)
+ void AssignPropertyFromResources (CodeMemberMethod method,
MemberInfo mi, string attvalue)
{
string resname = String.Format ("{0}.{1}", attvalue,
mi.Name);
bool isProperty = mi.MemberType == MemberTypes.Property;
@@ -749,42 +749,8 @@
new CodeTypeReferenceExpression
(typeof(System.Convert)),
"ToString");
convert.Parameters.Add (getlro);
- assign.Right = convert;
-
-// assign.Left = new CodeVariableReferenceExpression
(varname);
-// assign.Right = new CodeMethodInvokeExpression (
-// new CodeThisReferenceExpression (),
-// "GetLocalResourceObject",
-// new CodeExpression [] { new
CodePrimitiveExpression (resname) });
-// method.Statements.Add (assign);
+ assign.Right = convert;
-// // if (localResourceObject != null &&
localResourceObject.GetType() == typeof(member_type))
-// CodeConditionStatement ccs = new CodeConditionStatement
();
-// CodeBinaryOperatorExpression exp1 = new
CodeBinaryOperatorExpression (
-// new CodeVariableReferenceExpression (varname),
-// CodeBinaryOperatorType.IdentityInequality,
-// new CodePrimitiveExpression (null));
-
-// CodeBinaryOperatorExpression exp2 = new
CodeBinaryOperatorExpression (
-// new CodeMethodInvokeExpression (
-// new CodeVariableReferenceExpression
(varname),
-// "GetType",
-// new CodeExpression [] {}),
-// CodeBinaryOperatorType.IdentityEquality,
-// new CodeTypeOfExpression (
-// new CodeTypeReference
(member_type.ToString ())));
-// ccs.Condition = new CodeBinaryOperatorExpression (
-// exp1,
-// CodeBinaryOperatorType.BooleanAnd,
-// exp2);
-
-// // ctrlVar.Property = (member_type)obj;
-// assign = new CodeAssignStatement ();
-// assign.Left = new CodePropertyReferenceExpression
(ctrlVar, mi.Name);
-// assign.Right = new CodeCastExpression (
-// member_type.ToString (),
-// new CodeVariableReferenceExpression (varname));
-// ccs.TrueStatements.Add (assign);
method.Statements.Add (assign);
}
@@ -799,18 +765,10 @@
BindingFlags.Instance | BindingFlags.Static |
BindingFlags.Public |
BindingFlags.FlattenHierarchy);
- if (fields.Length > 0 || properties.Length > 0) {
- CodeVariableDeclarationStatement cvds = new
CodeVariableDeclarationStatement (
- typeof (object),
- "localResourceObject",
- new CodePrimitiveExpression (null));
- method.Statements.Add (cvds);
- }
-
foreach (FieldInfo fi in fields)
- AssignPropertyFromResources (method, fi,
attvalue, "localResourceObject");
+ AssignPropertyFromResources (method, fi,
attvalue);
foreach (PropertyInfo pi in properties)
- AssignPropertyFromResources (method, pi,
attvalue, "localResourceObject");
+ AssignPropertyFromResources (method, pi,
attvalue);
}
void AssignPropertiesFromResources (ControlBuilder builder,
string attvalue)
@@ -908,11 +866,14 @@
protected void CreateAssignStatementsFromAttributes
(ControlBuilder builder)
{
+#if NET_2_0
+ bool haveMetaKey = false;
+#endif
this.dataBoundAtts = 0;
IDictionary atts = builder.attribs;
if (atts == null || atts.Count == 0)
return;
-
+
foreach (string id in atts.Keys) {
if (InvariantCompareNoCase (id, "runat"))
continue;
@@ -921,9 +882,18 @@
/* we skip SkinID here as it's assigned in
BuildControlTree */
if (InvariantCompareNoCase (id, "skinid"))
continue;
+ if (InvariantCompareNoCase (id,
"meta:resourcekey")) {
+ haveMetaKey = true;
+ continue;
+ }
#endif
CreateAssignStatementFromAttribute (builder,
id);
}
+
+#if NET_2_0
+ if (haveMetaKey)
+ CreateAssignStatementFromAttribute (builder,
"meta:resourcekey");
+#endif
}
void CreateDBAttributeMethod (ControlBuilder builder, string
attr, string code)
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches