Add FieldLoader and linter support for BooleanExpression.

This commit is contained in:
Paul Chote
2016-11-13 15:10:39 +00:00
parent 23f4ae5027
commit 1cc7944437
3 changed files with 28 additions and 1 deletions

View File

@@ -11,7 +11,9 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using OpenRA.Support;
namespace OpenRA.Mods.Common.Lint
{
@@ -26,8 +28,13 @@ namespace OpenRA.Mods.Common.Lint
return (string[])fieldInfo.GetValue(ruleInfo);
if (type == typeof(HashSet<string>))
return (HashSet<string>)fieldInfo.GetValue(ruleInfo);
if (type == typeof(BooleanExpression))
{
var expr = (BooleanExpression)fieldInfo.GetValue(ruleInfo);
return expr != null ? expr.Variables : Enumerable.Empty<string>();
}
emitError("Bad type for reference on {0}.{1}. Supported types: string, string[], HashSet<string>"
emitError("Bad type for reference on {0}.{1}. Supported types: string, string[], HashSet<string>, BooleanExpression"
.F(ruleInfo.GetType().Name, fieldInfo.Name));
return new string[] { };