Added (Boolean|Integer)Expression subclasses of VariableExpression

This commit is contained in:
atlimit8
2017-04-11 02:52:54 -05:00
parent e73d3922dd
commit b0187dd646
6 changed files with 79 additions and 24 deletions

View File

@@ -29,13 +29,13 @@ namespace OpenRA.Mods.Common.Lint
if (typeof(IEnumerable<string>).IsAssignableFrom(type))
return fieldInfo.GetValue(ruleInfo) as IEnumerable<string>;
if (type == typeof(VariableExpression))
if (type == typeof(BooleanExpression) || type == typeof(IntegerExpression))
{
var expr = (VariableExpression)fieldInfo.GetValue(ruleInfo);
return expr != null ? expr.Variables : Enumerable.Empty<string>();
}
throw new InvalidOperationException("Bad type for reference on {0}.{1}. Supported types: string, IEnumerable<string>, BooleanExpression"
throw new InvalidOperationException("Bad type for reference on {0}.{1}. Supported types: string, IEnumerable<string>, BooleanExpression, IntegerExpression"
.F(ruleInfo.GetType().Name, fieldInfo.Name));
}
@@ -48,13 +48,13 @@ namespace OpenRA.Mods.Common.Lint
if (typeof(IEnumerable).IsAssignableFrom(type))
return (IEnumerable<string>)propertyInfo.GetValue(ruleInfo);
if (type == typeof(VariableExpression))
if (type == typeof(BooleanExpression) || type == typeof(IntegerExpression))
{
var expr = (VariableExpression)propertyInfo.GetValue(ruleInfo);
return expr != null ? expr.Variables : Enumerable.Empty<string>();
}
throw new InvalidOperationException("Bad type for reference on {0}.{1}. Supported types: string, IEnumerable<string>, BooleanExpression"
throw new InvalidOperationException("Bad type for reference on {0}.{1}. Supported types: string, IEnumerable<string>, BooleanExpression, IntegerExpression"
.F(ruleInfo.GetType().Name, propertyInfo.Name));
}
}