internal MSBuildPropertyValue Collapse(IMSBuildEvaluationContext context) { if (multiple != null) { var oldMultiple = multiple; multiple = new ExpressionNode[oldMultiple.Count]; for (int i = 0; i < multiple.Count; i++) { multiple[i] = new ExpressionText(0, context.Evaluate(oldMultiple[i]), true); } Value = multiple[0]; } else { Value = new ExpressionText(0, context.Evaluate(Value), true); } isCollapsed = true; return(this); }
// FIXME: need to make this more efficient. // can we ignore results where a property was simply not found? // can we tokenize it and check each level of the path exists before drilling down? // can we cache the filesystem lookups? public static IEnumerable <string> EvaluatePathWithPermutation( this IMSBuildEvaluationContext context, string pathExpression, string baseDirectory) { foreach (var p in EvaluateWithPermutation(context, null, ExpressionParser.Parse(pathExpression), 0)) { if (p == null) { continue; } yield return(MSBuildEscaping.FromMSBuildPath(context.Evaluate(p), baseDirectory)); } }
public static string EvaluatePath( this IMSBuildEvaluationContext context, ExpressionNode expression, string baseDirectory) => MSBuildEscaping.FromMSBuildPath(context.Evaluate(expression), baseDirectory);
//FIXME: recursive string Collapse(IMSBuildEvaluationContext context, string expression) { var expr = ExpressionParser.Parse(expression); return(context.Evaluate(expr)); }