X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=mcs%2Fclass%2FMicrosoft.Build.Engine%2FMicrosoft.Build.BuildEngine%2FBuildProperty.cs;h=f8701183adf847cf173df37e74b2eda7df633dc2;hb=d531a7515eaad9fb1c2ca9fff160851fa70aa168;hp=1ebadce9a23e54946020ac6b06902e21e1e8cd67;hpb=a8b22e0e864c03b8cfd2f2cb5a8075b6611c5553;p=mono.git diff --git a/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/BuildProperty.cs b/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/BuildProperty.cs index 1ebadce9a23..f8701183adf 100644 --- a/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/BuildProperty.cs +++ b/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/BuildProperty.cs @@ -42,7 +42,7 @@ namespace Microsoft.Build.BuildEngine { Project parentProject; PropertyType propertyType; - private BuildProperty () + BuildProperty () { } @@ -50,11 +50,9 @@ namespace Microsoft.Build.BuildEngine { : this (propertyName, propertyValue, PropertyType.Normal) { if (propertyName == null) - throw new ArgumentNullException (null, - "Parameter \"propertyName\" cannot be null."); + throw new ArgumentNullException ("propertyName"); if (propertyValue == null) - throw new ArgumentNullException (null, - "Parameter \"propertyValue\" cannot be null."); + throw new ArgumentNullException ("propertyValue"); } internal BuildProperty (string propertyName, @@ -76,7 +74,7 @@ namespace Microsoft.Build.BuildEngine { this.propertyType = PropertyType.Normal; this.parentProject = parentProject; this.name = propertyElement.Name; - this.value = propertyElement.InnerText; + this.value = propertyElement.InnerXml; this.isImported = false; } @@ -99,8 +97,9 @@ namespace Microsoft.Build.BuildEngine { public static explicit operator string (BuildProperty propertyToCast) { if (propertyToCast == null) - throw new ArgumentNullException ("propertyToCast"); - return propertyToCast.ToString (); + return String.Empty; + else + return propertyToCast.ToString (); } public override string ToString () @@ -113,15 +112,16 @@ namespace Microsoft.Build.BuildEngine { internal void Evaluate () { - if (FromXml) { - OldExpression exp = new OldExpression (parentProject); - exp.ParseSource (Value); - finalValue = (string) exp.ConvertTo (typeof (string)); - parentProject.EvaluatedProperties.AddProperty (this); - } + BuildProperty evaluated = new BuildProperty (Name, Value); + + Expression exp = new Expression (); + exp.Parse (Value, false, false); + evaluated.finalValue = (string) exp.ConvertTo (parentProject, typeof (string)); + + parentProject.EvaluatedProperties.AddProperty (evaluated); } - private bool FromXml { + internal bool FromXml { get { return propertyElement != null; } @@ -137,6 +137,8 @@ namespace Microsoft.Build.BuildEngine { set { if (FromXml) propertyElement.SetAttribute ("Condition", value); + else + throw new InvalidOperationException ("Cannot set a condition on an object not represented by an XML element in the project file."); } } @@ -164,7 +166,7 @@ namespace Microsoft.Build.BuildEngine { set { this.@value = value; if (FromXml) { - propertyElement.InnerText = value; + propertyElement.InnerXml = value; } else { finalValue = value; } @@ -176,6 +178,10 @@ namespace Microsoft.Build.BuildEngine { return propertyType; } } + + internal XmlElement XmlElement { + get { return propertyElement; } + } } internal enum PropertyType {