+2009-08-26 Ankit Jain <jankit@novell.com>
+
+ * Expression.cs: Correctly handle a item reference with transform
+ when allowItems is false. If item ref is ignored, then the transform
+ will get incorrectly matched as a metadata ref.
+ * ItemReference.cs (.ctor): Add a @original_string param.
+
2009-08-26 Ankit Jain <jankit@novell.com>
* Utilities.cs (UnescapeFromXml): New. From md.
}
}
- CopyToExpressionCollection (p3);
+ CopyToExpressionCollection (p3, allowItems);
}
void Prepare (List <ArrayList> l, int length)
l.Add (null);
}
- void CopyToExpressionCollection (List <ArrayList> lists)
+ void CopyToExpressionCollection (List <ArrayList> lists, bool allowItems)
{
for (int i = 0; i < lists.Count; i++) {
foreach (object o in lists [i]) {
if (o is string)
expressionCollection.Add (Utilities.Unescape ((string) o));
+ else if (!allowItems && o is ItemReference)
+ expressionCollection.Add (((ItemReference) o).OriginalString);
else if (o is IReference)
expressionCollection.Add ((IReference) o);
}
ArrayList SplitItems (string text, bool allowItems)
{
- if (!allowItems) {
- // FIXME: it's probably larger than 1
- ArrayList l = new ArrayList ();
- l.Add (text);
- return l;
- }
-
ArrayList phase1 = new ArrayList ();
Match m;
m = ItemRegex.Match (text);
if (m.Groups [ItemRegex.GroupNumberFromName ("has_separator")].Success)
separator = m.Groups [ItemRegex.GroupNumberFromName ("separator")].Value;
- ir = new ItemReference (name, transform, separator, m.Groups [0].Index, m.Groups [0].Length);
+ ir = new ItemReference (text.Substring (m.Groups [0].Index, m.Groups [0].Length),
+ name, transform, separator, m.Groups [0].Index, m.Groups [0].Length);
phase1.Add (ir);
m = m.NextMatch ();
}
Expression separator;
int start;
int length;
+ string original_string;
- public ItemReference (string itemName, string transform, string separator, int start, int length)
+ public ItemReference (string original_string, string itemName, string transform, string separator, int start, int length)
{
this.itemName = itemName;
this.start = start;
this.length = length;
+ this.original_string = original_string;
if (transform != null) {
this.transform = new Expression ();
get { return separator; }
}
+ public string OriginalString {
+ get { return original_string; }
+ }
+
public int Start {
get { return start; }
}
public override string ToString ()
{
- //FIXME: transform
- return "@" + itemName;
+ return original_string;
}
}
}
+2009-08-26 Ankit Jain <jankit@novell.com>
+
+ * CreateItemTest.cs (TestVariableExpansion): Update test to
+ use a transform with a item reference in a property.
+
2009-08-26 Ankit Jain <jankit@novell.com>
* CreateItemTest.cs (TestVariableExpansion): New.
<P1>FooP1</P1>
<P2>FooP2</P2>
<C>@(IG)</C>
- <P3>@(Nine)</P3>
+ <P3>@(Nine->'%(Identity)')</P3>
</PropertyGroup>
<ItemGroup>
<Nine Include=""Nine""/>
Assert.AreEqual ("Eight", include[3].FinalItemSpec, "A#6");
Assert.AreEqual ("Nine", include[4].FinalItemSpec, "A#7");
- testLogger.CheckLoggedMessageHead ("C: Abc;FooP1;FooP2;Eight;Nine", "A#10");
+ testLogger.CheckLoggedMessageHead ("C: Abc;FooP1;FooP2;Eight;Nine", "A#9");
testLogger.CheckLoggedMessageHead ("items: Abc;FooP1;FooP2;Eight;Nine", "A#10");
}