src/NFun/Tic/SolvingFunctions.cs
/// <summary>
/// Transform constrains state to array state
/// </summary>
Transform constrains state to array state
Transform constrains state to array state
public static StateArray TransformToArrayOrNull(object descNodeName, ConstrainsState descendant) {
        if (descendant.NoConstrains)
        {
            var constrains = new ConstrainsState();
            var eName = "e" + descNodeName.ToString().ToLower() + "'";
            var node = TicNode.CreateTypeVariableNode(eName, constrains);
            return new StateArray(node);
        }
        else if (descendant.HasDescendant && descendant.Descendant is StateArray arrayEDesc)
        {
            if (arrayEDesc.Element is StateRefTo)
            {
                var origin = arrayEDesc.ElementNode.GetNonReference();
                if (origin.IsSolved)
                    return new StateArray(origin);
            }
            else if (arrayEDesc.ElementNode.IsSolved)
            {
                return arrayEDesc;
            }
        }
        return null;
    }
public static StateArray TransformToArrayOrNull ( object descNodeName , ConstrainsState descendant ) { if ( descendant . NoConstrains ) { var constrains = new ConstrainsState ( ) ; var eName = " " + descNodeName . ToString ( ) . ToLower ( ) + " " ; var node = TicNode . CreateTypeVariableNode ( eName , constrains ) ; return new StateArray ( node ) ; } else if ( descendant . HasDescendant && descendant . Descendant is StateArray arrayEDesc ) { if ( arrayEDesc . Element is StateRefTo ) { var origin = arrayEDesc . ElementNode . GetNonReference ( ) ; if ( origin . IsSolved ) return new StateArray ( origin ) ; } else if ( arrayEDesc . ElementNode . IsSolved ) { return arrayEDesc ; } } return null ; }
Transform constrains state to array state
Transform constrains state to array state
descNodeName
object
descendant
ConstrainsState