private ElementAttributeScope GetRequiredScope(IConditionExpression expression)
{
ElementAttributeScope scope = ElementAttributeScope.Element;
if (expression != null)
{
ElementAttributeExpression attributeExpression = expression as ElementAttributeExpression;
if (attributeExpression != null)
{
scope = attributeExpression.Scope;
}
else
{
ElementAttributeScope leftScope = GetRequiredScope(expression.Left);
ElementAttributeScope rightScope = GetRequiredScope(expression.Right);
if (leftScope > rightScope)
{
scope = leftScope;
}
else
{
scope = rightScope;
}
}
}
return scope;
}