Imported Upstream version 3.8.0

Former-commit-id: 6a76a29bd07d86e57c6c8da45c65ed5447d38a61
This commit is contained in:
Jo Shields
2014-09-04 09:07:35 +01:00
parent a575963da9
commit fe777c5c82
1062 changed files with 12460 additions and 5983 deletions

View File

@@ -40,6 +40,8 @@
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.COMException))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.ComMemberType))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.ComSourceInterfacesAttribute))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.ComTypes.IStream))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.ComTypes.STATSTG))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.CriticalHandle))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.CurrencyWrapper))]
//[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.CustomQueryInterfaceMode))]
@@ -76,4 +78,3 @@
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.UnmanagedType))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.VarEnum))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.VariantWrapper))]

View File

@@ -25,7 +25,7 @@ net_1_1_java_SUBDIRS = \
System.Runtime.Serialization.Formatters.Soap \
System.Runtime.Remoting
common_dirs := \
net_2_0_dirs := \
corlib \
System \
System.XML \
@@ -78,14 +78,11 @@ common_dirs := \
Mono.Cecil \
Mono.Cecil.Mdb \
Mono.Debugger.Soft \
SystemWebTestShim
net_2_0_dirs := \
SystemWebTestShim \
System.Xml.Linq \
System.Runtime.Serialization \
System.Data.DataSetExtensions \
System.Data.Linq \
System.Web \
System.Web.Abstractions \
System.Web.Routing \
System.IdentityModel \
@@ -179,7 +176,6 @@ net_4_0_dirs := \
System.Xaml \
WindowsBase \
System.ServiceModel.Activation \
System.ServiceModel \
System.ServiceModel.Routing \
System.ServiceModel.Discovery \
System.Runtime.Caching \
@@ -241,7 +237,7 @@ xbuild_4_0_dirs := \
$(xbuild_2_0_dirs) \
Microsoft.Build
net_2_0_SUBDIRS := $(common_dirs) $(net_2_0_dirs) $(net_2_0_only_dirs) $(xbuild_2_0_dirs) aot-compiler
net_2_0_SUBDIRS := $(net_2_0_dirs) $(net_2_0_only_dirs) $(xbuild_2_0_dirs) aot-compiler
monodroid_SUBDIRS := $(mobile_dirs) $(monodroid_dirs)
monotouch_SUBDIRS := $(mobile_dirs) $(monotouch_dirs)
monotouch_runtime_SUBDIRS := $(monotouch_runtime_dirs)
@@ -249,13 +245,13 @@ mobile_static_SUBDIRS := $(mobile_dirs)
mobile_SUBDIRS := $(mobile_dirs)
xammac_SUBDIRS := $(mobile_dirs) $(xammac_dirs)
net_3_5_SUBDIRS := $(xbuild_2_0_dirs)
net_4_0_SUBDIRS := $(common_dirs) $(net_2_0_dirs) $(net_4_0_dirs) $(net_4_0_only_dirs) $(xbuild_4_0_dirs)
net_4_5_SUBDIRS := $(common_dirs) $(net_2_0_dirs) $(net_4_0_dirs) $(net_4_5_dirs) $(xbuild_4_0_dirs) aot-compiler
net_4_0_SUBDIRS := $(net_2_0_dirs) $(net_4_0_dirs) $(net_4_0_only_dirs) $(xbuild_4_0_dirs)
net_4_5_SUBDIRS := $(net_2_0_dirs) $(net_4_0_dirs) $(net_4_5_dirs) $(xbuild_4_0_dirs) aot-compiler
xbuild_12_SUBDIRS := $(xbuild_4_0_dirs)
include ../build/rules.make
SUBDIRS = $(common_dirs) $(net_2_0_dirs) $(net_2_0_only_dirs) $(mobile_dirs) $(monotouch_dirs) $(net_4_0_dirs) $(net_4_0_only_dirs) $(net_4_5_dirs)
SUBDIRS = $(net_2_0_dirs) $(net_2_0_only_dirs) $(mobile_dirs) $(monotouch_dirs) $(net_4_0_dirs) $(net_4_0_only_dirs) $(net_4_5_dirs)
DIST_ONLY_SUBDIRS = dlr aot-compiler $(xbuild_4_0_dirs)

View File

@@ -93,7 +93,10 @@ TEST_DISTFILES = \
Test/resources/32x32.ico \
Test/System.Resources/compat_1_1.resx \
Test/System.Resources/compat_2_0.resx \
Test/System.Windows.Forms/bitmaps/a.png
Test/System.Windows.Forms/bitmaps/a.png \
Test/DummyAssembly/AnotherSerializable.cs \
Test/DummyAssembly/Convertable.cs \
Test/DummyAssembly/Properties/AssemblyInfo.cs \
EXTRA_DISTFILES = \
README System.Windows.Forms.dll.resources \
@@ -106,6 +109,11 @@ TEST_MCS_FLAGS = /r:System.Data.dll /r:System.Drawing.dll /r:Accessibility.dll -
-resource:Test/resources/32x32.ico,32x32.ico \
-nowarn:618,612
DummyAssembly.dll:
$(CSCOMPILE) /target:library /out:$@ Test/DummyAssembly/AnotherSerializable.cs Test/DummyAssembly/Convertable.cs Test/DummyAssembly/Properties/AssemblyInfo.cs
test-local: DummyAssembly.dll
include ../../build/library.make
TEST_HARNESS_EXCLUDES = -exclude=Interactive,NotWorking,ValueAdd,CAS,InetAccess

View File

@@ -207,6 +207,7 @@ namespace System.Windows.Forms {
private void OnParentCurrencyManagerChanged (object sender, EventArgs args)
{
// Essentially handles chained data sources (e.g. chained BindingSource)
ResetDataMemberIfInvalid ();
ResetList ();
}
@@ -349,6 +350,7 @@ namespace System.Windows.Forms {
DisconnectDataSourceEvents (datasource);
datasource = value;
ResetDataMemberIfInvalid ();
ConnectDataSourceEvents (datasource);
ResetList ();
@@ -454,6 +456,19 @@ namespace System.Windows.Forms {
}
}
void ResetDataMemberIfInvalid ()
{
if (datamember == String.Empty)
return;
// if dataMember doesn't refer to a valid property of dataSource, we need to reset it
var property = ListBindingHelper.GetListItemProperties (datasource).Find (datamember, true);
if (property == null) {
datamember = String.Empty;
OnDataMemberChanged (EventArgs.Empty);
}
}
// NOTE: Probably the parsing can be improved
void ProcessSortString (string sort)
{

View File

@@ -390,7 +390,8 @@ namespace System.Windows.Forms {
else if (e.NewIndex <= listposition) {
/* the deleted row was either the current one, or one earlier in the list.
Update the index and emit PositionChanged, CurrentChanged, and ItemChanged. */
ChangeRecordState (listposition+1,
// FIXME: this looks wrong, shouldn't it be (listposition - 1) instead of e.NewIndex ?
ChangeRecordState (e.NewIndex,
false, false, e.NewIndex != listposition, false);
}
else {
@@ -412,7 +413,7 @@ namespace System.Windows.Forms {
}
else {
if (e.NewIndex <= listposition) {
ChangeRecordState (e.NewIndex,
ChangeRecordState (listposition + 1,
false, false, false, false);
OnItemChanged (new ItemChangedEventArgs (-1));
OnListChanged (e);

View File

@@ -150,7 +150,7 @@ namespace System.Windows.Forms {
}
*/
static byte [] header = new byte []{ 77, 83, 70, 116, 73, 76, 3, 0 };
static byte [] header = new byte []{ 77, 83, 70, 116, 73, 76, 1, 1 };
public void GetObjectData (SerializationInfo si, StreamingContext context)
{
MemoryStream stream = new MemoryStream ();
@@ -169,7 +169,7 @@ namespace System.Windows.Forms {
writer.Write ((ushort) (images [0].Width));
writer.Write ((ushort) (images [0].Height));
writer.Write (0xFFFFFFFF); //BackColor.ToArgb ()); //FIXME: should set the right one here.
writer.Write ((ushort) 0x1009);
writer.Write ((ushort) 0x21);
for (int i = 0; i < 4; i++)
writer.Write ((short) -1);

View File

@@ -1 +1 @@
c1b7d791f8d2974c14d91a11622fb822eee0dafa
f7075e8ef8f7cfbc0c67a85dbedc54b114523b38

View File

@@ -109,7 +109,7 @@ namespace System.Windows.Forms {
hexadecimal = false;
increment = 1M;
maximum = 100M;
minimum = 0.0M;
minimum = 0M;
thousands_separator = false;
Text = "0";

View File

@@ -1 +1 @@
e05a093aac549755036f160867f3515bc78def96
1f3af25846450af900f33b95ed551929392ee807

View File

@@ -0,0 +1,88 @@
//
// AnotherSerializable.cs : Serializable Class used to test types from other
// assemblies for resources tests
//
// Author:
// Gary Barnett (gary.barnett.mono@gmail.com)
//
// Copyright (C) Gary Barnett (2012)
//
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.Runtime.Serialization;
using System.IO;
using System.Runtime.Serialization.Formatters.Binary;
namespace DummyAssembly {
[SerializableAttribute]
public class AnotherSerializable : ISerializable {
public string name;
public string value;
public AnotherSerializable ()
{
}
public AnotherSerializable (string name, string value)
{
this.name = name;
this.value = value;
}
public AnotherSerializable (SerializationInfo info, StreamingContext ctxt)
{
name = (string) info.GetValue ("sername", typeof (string));
value = (String) info.GetValue ("servalue", typeof (string));
}
public AnotherSerializable (Stream stream)
{
BinaryFormatter bFormatter = new BinaryFormatter ();
AnotherSerializable deser = (AnotherSerializable) bFormatter.Deserialize (stream);
stream.Close ();
name = deser.name;
value = deser.value;
}
public void GetObjectData (SerializationInfo info, StreamingContext ctxt)
{
info.AddValue ("sername", name);
info.AddValue ("servalue", value);
}
public override string ToString ()
{
return String.Format ("name={0};value={1}", this.name, this.value);
}
public override bool Equals (object obj)
{
AnotherSerializable o = obj as AnotherSerializable;
if (o == null)
return false;
return this.name.Equals (o.name) && this.value.Equals (o.value);
}
}
}

View File

@@ -0,0 +1,119 @@
//
// Convertable.cs : Class with type converter used to test types from other
// assemblies for resources tests
//
// Author:
// Gary Barnett (gary.barnett.mono@gmail.com)
//
// Copyright (C) Gary Barnett (2012)
//
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.Serialization.Formatters.Binary;
using System.IO;
using System.Runtime.Serialization;
using System.ComponentModel;
namespace DummyAssembly {
[SerializableAttribute]
[TypeConverter (typeof (ConvertableConverter))]
public class Convertable {
protected string name;
protected string value;
public Convertable ()
{
}
public Convertable (string name, string value)
{
this.name = name;
this.value = value;
}
public void GetObjectData (SerializationInfo info, StreamingContext ctxt)
{
info.AddValue ("sername", name);
info.AddValue ("servalue", value);
}
public override string ToString ()
{
return String.Format ("{0}\t{1}",name, value);
}
public override bool Equals (object obj)
{
Convertable o = obj as Convertable;
if (o == null)
return false;
return this.name.Equals (o.name) && this.value.Equals (o.value);
}
}
class ConvertableConverter : TypeConverter {
public ConvertableConverter ()
{
}
public override bool CanConvertFrom (ITypeDescriptorContext context, Type sourceType)
{
return sourceType == typeof (string);
}
public override bool CanConvertTo (ITypeDescriptorContext context, Type destinationType)
{
return destinationType == typeof (string);
}
public override object ConvertFrom (ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value)
{
if (value.GetType() != typeof (string))
throw new Exception ("value not string");
string serialised = (string) value;
string [] parts = serialised.Split ('\t');
if (parts.Length != 2)
throw new Exception ("string in incorrect format");
Convertable convertable = new Convertable (parts [0], parts [1]);
return convertable;
}
public override object ConvertTo (ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destinationType)
{
if (destinationType != typeof (String)) {
return base.ConvertTo (context, culture, value, destinationType);
}
return ((Convertable) value).ToString ();
}
}
}

View File

@@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle ("DummyAssembly")]
[assembly: AssemblyDescription ("")]
[assembly: AssemblyConfiguration ("")]
[assembly: AssemblyCompany ("")]
[assembly: AssemblyProduct ("DummyAssembly")]
[assembly: AssemblyCopyright ("")]
[assembly: AssemblyTrademark ("")]
[assembly: AssemblyCulture ("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible (false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid ("c80e062b-a918-4aa5-b62c-7455ca2c56d5")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion ("1.0.0.0")]
[assembly: AssemblyFileVersion ("1.0.0.0")]

View File

@@ -144,15 +144,14 @@ namespace MonoTests.System.Resources {
[Test]
public void WriteRead1 ()
{
ResXResourceWriter rw = new ResXResourceWriter ("resx.resx");
serializable ser = new serializable ("aaaaa", "bbbbb");
ResXDataNode dn = new ResXDataNode ("test", ser);
dn.Comment = "comment";
rw.AddResource (dn);
rw.Close ();
string resXFile = GetResXFileWithNode (dn, "resx.resx");
bool found = false;
ResXResourceReader rr = new ResXResourceReader ("resx.resx");
ResXResourceReader rr = new ResXResourceReader (resXFile);
rr.UseResXDataNodes = true;
IDictionaryEnumerator en = rr.GetEnumerator ();
while (en.MoveNext ()) {
@@ -224,7 +223,6 @@ namespace MonoTests.System.Resources {
ResXDataNode node = ((DictionaryEntry) en.Current).Value as ResXDataNode;
rr.Close ();
File.Delete ("resx.resx");
Assert.IsNotNull (node,"#A1");
serializable o = node.GetValue ((AssemblyName []) null) as serializable;
@@ -245,7 +243,6 @@ namespace MonoTests.System.Resources {
ResXDataNode node = ((DictionaryEntry) en.Current).Value as ResXDataNode;
rr.Close ();
File.Delete ("resx.resx");
Assert.IsNotNull (node, "#A1");
object o = node.GetValue ((AssemblyName []) null);

View File

@@ -104,6 +104,7 @@ namespace MonoTests.System.Windows.Forms
}
[Test]
[Category ("NotWorking")] // Doesn't work under Xvfb.
public void DataRemainsOnClipboard_Xamarin4959 ()
{
// Compile an app that puts something on the clipboard

View File

@@ -172,6 +172,8 @@ namespace MonoTests.System.Windows.Forms.DataBinding
row.Delete ();
Assert.AreEqual (-1, cm.Position);
// Console.WriteLine (event_log);
Assert.AreEqual (
@@ -221,6 +223,8 @@ namespace MonoTests.System.Windows.Forms.DataBinding
row.Delete ();
Assert.AreEqual (0, cm.Position);
Console.WriteLine (event_log);
Assert.AreEqual (
@@ -273,6 +277,8 @@ namespace MonoTests.System.Windows.Forms.DataBinding
row.Delete ();
Assert.AreEqual (0, cm.Position);
Console.WriteLine (event_log);
#if WITH_BINDINGS
@@ -323,6 +329,8 @@ namespace MonoTests.System.Windows.Forms.DataBinding
row.Delete ();
Assert.AreEqual (0, cm.Position);
Console.WriteLine (event_log);
Assert.AreEqual (
@@ -379,6 +387,8 @@ namespace MonoTests.System.Windows.Forms.DataBinding
DataRow newrow = dataSet1.Tables[0].NewRow ();
dataSet1.Tables[0].Rows.Add(newrow);
Assert.AreEqual (0, cm.Position);
Console.WriteLine (event_log);
Assert.AreEqual (
@@ -434,6 +444,8 @@ namespace MonoTests.System.Windows.Forms.DataBinding
newrow = dataSet1.Tables[0].NewRow ();
dataSet1.Tables[0].Rows.Add(newrow);
Assert.AreEqual (0, cm.Position);
Console.WriteLine (event_log);
#if WITH_BINDINGS
@@ -489,6 +501,8 @@ namespace MonoTests.System.Windows.Forms.DataBinding
newrow = dataSet1.Tables[0].NewRow ();
dataSet1.Tables[0].Rows.InsertAt(newrow, 0);
Assert.AreEqual (2, cm.Position);
Console.WriteLine (event_log);
Assert.AreEqual (
@@ -547,6 +561,8 @@ namespace MonoTests.System.Windows.Forms.DataBinding
newrow = dataSet1.Tables[0].NewRow ();
dataSet1.Tables[0].Rows.InsertAt(newrow, 1);
Assert.AreEqual (2, cm.Position);
Console.WriteLine (event_log);
Assert.AreEqual (
@@ -596,6 +612,8 @@ namespace MonoTests.System.Windows.Forms.DataBinding
dataSet1.Tables[0].Columns.Add();
Assert.AreEqual (-1, cm.Position);
Console.WriteLine (event_log);
#if NET_2_0
@@ -635,6 +653,8 @@ namespace MonoTests.System.Windows.Forms.DataBinding
dataSet1.Tables[0].Columns.Remove(dataSet1.Tables[0].Columns[1]);
Assert.AreEqual (-1, cm.Position);
Console.WriteLine (event_log);
Assert.AreEqual ("0: MetaDataChanged\n", event_log, "2");
@@ -672,6 +692,8 @@ namespace MonoTests.System.Windows.Forms.DataBinding
dataSet1.Tables[0].Columns.Remove(dataSet1.Tables[0].Columns[0]);
Assert.AreEqual (-1, cm.Position);
Console.WriteLine (event_log);
Assert.AreEqual ("0: MetaDataChanged\n", event_log, "3");
@@ -717,6 +739,8 @@ namespace MonoTests.System.Windows.Forms.DataBinding
dataSet1.Tables[0].Columns[0].ColumnName = "new name";
Assert.AreEqual (-1, cm.Position);
Console.WriteLine (event_log);
Assert.AreEqual ("0: MetaDataChanged\n", event_log, "3");
@@ -775,6 +799,8 @@ namespace MonoTests.System.Windows.Forms.DataBinding
row[column_name] = "hi";
row.EndEdit ();
Assert.AreEqual (0, cm.Position);
Console.WriteLine (event_log);
Assert.AreEqual (
@@ -834,6 +860,8 @@ namespace MonoTests.System.Windows.Forms.DataBinding
row[column_name] = "hi";
cm.CancelCurrentEdit ();
Assert.AreEqual (0, cm.Position);
Console.WriteLine (event_log);
Assert.AreEqual ("0: ItemChanged (index = 0)\n", event_log, "2");
@@ -875,6 +903,8 @@ namespace MonoTests.System.Windows.Forms.DataBinding
DataRowView row = (DataRowView)cm.Current;
row.Delete ();
Assert.AreEqual (-1, cm.Position);
Console.WriteLine (event_log);
Assert.AreEqual (

View File

@@ -642,6 +642,7 @@ namespace MonoTests.System.Windows.Forms
private static int oipt_t1 = 0;
private static int oipt_t2 = 0;
[Test]
[NUnit.Framework.Category ("NotWorking")]
public void OneIdlePerThread () {
Thread t = Thread.CurrentThread;
oipt_t1 = t.ManagedThreadId;

View File

@@ -1 +1 @@
f6f5fadb7df800a00159edd72fc76b254c96b3a9
4fac9f436ca5607cef5cc90e693448cbee76000e

View File

@@ -182,7 +182,7 @@ namespace Microsoft.Build.BuildEngine {
e = new ConditionFactorExpression (token);
} else if (token.Type == TokenType.Item || token.Type == TokenType.Property
|| token.Type == TokenType.Metadata) {
e = ParseReferenceExpression (token.Value);
e = ParseReferenceExpression (token.Value [0]);
} else if (token.Type == TokenType.Not) {
e = ParseNotExpression ();
} else
@@ -224,21 +224,33 @@ namespace Microsoft.Build.BuildEngine {
}
//@prefix: @ or $
ConditionExpression ParseReferenceExpression (string prefix)
ConditionExpression ParseReferenceExpression (char prefix)
{
StringBuilder sb = new StringBuilder ();
string ref_type = prefix [0] == '$' ? "a property" : "an item list";
int token_pos = tokenizer.Token.Position;
string ref_type = prefix == '$' ? "a property" : "an item list";
IsAtToken (TokenType.LeftParen, String.Format (
"Expected {0} at position {1} in condition \"{2}\". Missing opening parantheses after the '{3}'.",
ref_type, token_pos, conditionStr, prefix));
tokenizer.GetNextToken ();
if (prefix == '$') {
//
// Tjhe scan should consider quoted parenthesis but it breaks on .net as well
// we are bug compatible
//
tokenizer.ScanForClosingParens ();
} else {
tokenizer.GetNextToken ();
}
if (tokenizer.IsEOF ())
throw new ExpressionParseException ("Missing closing parenthesis in condition " + conditionStr);
StringBuilder sb = new StringBuilder ();
sb.AppendFormat ("{0}({1}", prefix, tokenizer.Token.Value);
tokenizer.GetNextToken ();
if (prefix == "@" && tokenizer.Token.Type == TokenType.Transform) {
if (prefix == '@' && tokenizer.Token.Type == TokenType.Transform) {
tokenizer.GetNextToken ();
sb.AppendFormat ("->'{0}'", tokenizer.Token.Value);
@@ -250,9 +262,7 @@ namespace Microsoft.Build.BuildEngine {
}
}
IsAtToken (TokenType.RightParen, String.Format (
"Expected {0} at position {1} in condition \"{2}\". Missing closing parantheses'.",
ref_type, token_pos, conditionStr, prefix));
IsAtToken (TokenType.RightParen, "Missing closing parenthesis in condition " + conditionStr);
tokenizer.GetNextToken ();
sb.Append (")");

View File

@@ -257,6 +257,29 @@ namespace Microsoft.Build.BuildEngine {
} else
throw new ExpressionParseException (String.Format ("Invalid token: {0}", ch));
}
public void ScanForClosingParens (int parensCounter = 1)
{
tokenPosition = position;
int start = position;
int ch;
while ((ch = ReadChar ()) >= 0) {
switch (ch) {
case ')':
if (--parensCounter == 0) {
--position;
token = new Token (inputString.Substring (start, position - start), TokenType.String, tokenPosition);
return;
}
break;
case '(':
++parensCounter;
break;
}
}
token = new Token (null, TokenType.EOF, tokenPosition);
}
public int TokenPosition {
get { return tokenPosition; }

View File

@@ -55,6 +55,14 @@ namespace Microsoft.Build.BuildEngine {
internal class Expression {
enum TokenKind
{
OpenParens,
CloseParens,
Dot,
End
}
ExpressionCollection expressionCollection;
static Regex item_regex;
@@ -232,6 +240,7 @@ namespace Microsoft.Build.BuildEngine {
pos += 2;
int start = pos;
int end = 0;
bool requires_closing_parens = true;
var ch = text [pos];
if ((ch == 'r' || ch == 'R') && text.Substring (pos + 1).StartsWith ("egistry:", StringComparison.OrdinalIgnoreCase)) {
@@ -273,6 +282,7 @@ namespace Microsoft.Build.BuildEngine {
// Simple property reference $(Foo)
//
phase.Add (new PropertyReference (name));
requires_closing_parens = false;
} else {
end = 0;
}
@@ -287,6 +297,14 @@ namespace Microsoft.Build.BuildEngine {
pos = end;
}
if (requires_closing_parens) {
end = text.IndexOf (')', pos);
if (end < 0)
end = 0;
else
pos = end + 1;
}
}
end = text.IndexOf ("$(", pos, StringComparison.Ordinal);
@@ -493,70 +511,71 @@ namespace Microsoft.Build.BuildEngine {
static MemberInvocationReference ParseInvocation (string text, ref int p, Type type, IReference instance)
{
var open_parens = text.IndexOf ('(', p);
string name;
int end;
List<string> args;
TokenKind token;
MemberInvocationReference mir = null;
//
// Is it method or property
//
if (open_parens > 0) {
name = text.Substring (p, open_parens - p);
while (true) {
int prev = p;
token = ScanName (text, ref p);
var name = text.Substring (prev, p - prev).TrimEnd ();
//
// It can be instance method on static property
//
if (name.IndexOf ('.') > 0) {
var names = name.Split ('.');
int i;
for (i = 0; i < names.Length - 1; ++i) {
instance = new MemberInvocationReference (type, names [i]) {
Instance = instance
};
}
switch (token) {
case TokenKind.Dot:
case TokenKind.OpenParens:
break;
case TokenKind.CloseParens:
return new MemberInvocationReference (type, name) {
Instance = instance
};
type = null;
name = names [i];
}
++open_parens;
args = ParseArguments (text, ref open_parens);
end = text.IndexOf (')', open_parens);
} else {
end = text.IndexOf (')', p);
if (end < 0)
throw new InvalidProjectFileException (string.Format ("Invalid static method invocation syntax '{0}'", text.Substring (p)));
case TokenKind.End:
if (mir == null || name.Length != 0)
throw new InvalidProjectFileException (string.Format ("Invalid static method invocation syntax '{0}'", text.Substring (p)));
name = text.Substring (p, end - p);
//
// It can be instance member on static property
//
if (name.IndexOf ('.') > 0) {
var names = name.Split ('.');
int i;
for (i = 0; i < names.Length - 1; ++i) {
instance = new MemberInvocationReference (type, names [i]) {
Instance = instance
};
}
type = null;
name = names [i];
return mir;
default:
throw new NotImplementedException ();
}
args = null;
instance = mir = new MemberInvocationReference (type, name) {
Instance = instance
};
if (type != null) {
if (!IsMethodAllowed (type, name))
throw new InvalidProjectFileException (string.Format ("The function '{0}' on type '{1}' has not been enabled for execution", name, type.FullName));
type = null;
}
if (token == TokenKind.OpenParens) {
++p;
mir.Arguments = ParseArguments (text, ref p);
}
if (p < text.Length && text [p] == '.') {
++p;
continue;
}
return mir;
}
}
static TokenKind ScanName (string text, ref int p)
{
for (; p < text.Length; ++p) {
switch (text [p]) {
case '(':
return TokenKind.OpenParens;
case '.':
return TokenKind.Dot;
case ')':
return TokenKind.CloseParens;
}
}
name = name.TrimEnd ();
if (!IsMethodAllowed (type, name))
throw new InvalidProjectFileException (string.Format ("The function '{0}' on type '{1}' has not been enabled for execution", name, type.FullName));
p = end + 1;
return new MemberInvocationReference (type, name) {
Arguments = args,
Instance = instance
};
return TokenKind.End;
}
ArrayList SplitMetadata (string text)

Some files were not shown because too many files have changed in this diff Show More