public VariableVariant([NotNull] Variable value, [NotNull] AnalysisContext context) : base(value, context) { switch (value) { case {} when value.TypeRef == null: Value = new DataValueUnknown(); break; case {} when value.TypeRef is PrimitiveTypeRef primitiveTypeRef: var typeMinValue = primitiveTypeRef.MinValue; var typeMaxValue = primitiveTypeRef.MaxValue; if (typeMinValue != null && typeMaxValue != null) { Value = new DataValueInterval(new ValueInterval(typeMinValue, typeMaxValue), Array.Empty <LogicExpressionBase>()); } else { Value = new DataValueUnknown(); } break; case { } when value.TypeRef is ClassTypeRef: Value = new DataValueUnknown(); break; default: throw new ArgumentOutOfRangeException(nameof(value)); } }
public ArrayItemVariant([NotNull] Variable arrayStorage, [NotNull] TypeReference typeRef, [NotNull] ValueInterval index, [NotNull] AnalysisContext context) : base(arrayStorage, typeRef, context) { Index = index ?? throw new ArgumentNullException(nameof(index)); Value = new DataValueUnknown(); switch (typeRef) { case PrimitiveTypeRef primitiveTypeRef: var defaultValue = primitiveTypeRef.DefaultValue; if (defaultValue is OrderedLiteralBase defaultOrderedValue) { Value = new DataValueInterval(ValueInterval.Single(defaultOrderedValue), Array.Empty <LogicExpressionBase>()); } break; default: throw new ArgumentOutOfRangeException(nameof(typeRef)); } }