private Variable ParceType(UHeaderParser.TypeContext context) { var typeName = context.typeName().GetText(); Variable variable; if (PrimitiveVariable.PrimitiveTypes.Contains(typeName)) { variable = new PrimitiveVariable(typeName); } else { var type = GetType(context); if (type is Class) { variable = new ClassVariable((Class)type); } else if (type is Delegate) { variable = new DelegateVariable((Delegate)type); } else if (type is Enum) { variable = new EnumVariable((Enum)type); } else { throw new InvalidOperationException(); } } variable.IsConst = context.FoundChild <UHeaderParser.IsConstContext>(); variable.IsPointer = context.FoundChild <UHeaderParser.IsPtrQuantContext>(); variable.IsReference = context.FoundChild <UHeaderParser.IsRefQuantContext>(); variable.IsInterface = typeName.StartsWith("I"); return(variable); }
protected virtual void Init(S StartState) { this.CurrentState = new EnumVariable <S>(StartState, this.OnStateChanged); InitializeStatesByCallingCallbacks(); }
[SetUp] public new void Init() { Variable = new EnumVariable<TestEnum>(Bar, TestEnum.Choice1); }