Пример #1
0
        protected ImmutableBorrowNode()
        {
            var immutableReferenceType = NITypes.Void.CreateImmutableReference();

            FixedTerminals.Add(new NodeTerminal(Direction.Input, immutableReferenceType, "value in"));
            FixedTerminals.Add(new NodeTerminal(Direction.Output, immutableReferenceType, "reference out"));
        }
Пример #2
0
 protected FunctionalNode(NIType signature)
 {
     Signature = signature;
     foreach (NodeTerminal terminal in CreateNodeTerminalsFromSignature(signature))
     {
         FixedTerminals.Add(terminal);
     }
     Width = StockDiagramGeometries.GridSize * 4;
 }
Пример #3
0
        protected TerminateLifetime()
        {
            var immutableReferenceType = NITypes.Void.CreateImmutableReference();
            var inputTerminal          = new NodeTerminal(Direction.Input, immutableReferenceType, "inner lifetime 0");

            FixedTerminals.Add(inputTerminal);
            var outputTerminal = new NodeTerminal(Direction.Output, immutableReferenceType, "outer lifetime");

            FixedTerminals.Add(outputTerminal);
        }
Пример #4
0
        private void UpdateTerminalsFromDataType(NIType type)
        {
            bool isStruct = type.IsValueClass();
            bool isUnion  = type.IsUnion();

            if (isStruct || isUnion)
            {
                NIType[] fields             = type.GetFields().ToArray();
                int      inputTerminalCount = isStruct ? fields.Length : 1;
                if (!InputTerminals.HasExactly(inputTerminalCount))
                {
                    while (inputTerminalCount < InputTerminals.Count())
                    {
                        FixedTerminals.Remove(FixedTerminals.Last());
                    }
                    while (inputTerminalCount > InputTerminals.Count())
                    {
                        int index = InputTerminals.Count();
                        FixedTerminals.Add(new ConstructorTerminal(NITypes.Void, $"element{index}"));
                    }
                    if (isStruct)
                    {
                        foreach (var pair in FixedTerminals.Skip(1).Cast <ConstructorTerminal>().Zip(fields))
                        {
                            pair.Key.FieldName = pair.Value.GetName();
                        }
                    }
                    else
                    {
                        // TODO: attempt to recover the same variant element index
                        ((ConstructorTerminal)FixedTerminals[1]).FieldName = fields[0].GetName();
                    }
                }
                SetGeometry();
            }
        }
Пример #5
0
 protected DropNode()
 {
     FixedTerminals.Add(new NodeTerminal(Direction.Input, PFTypes.Void, "value"));
 }
Пример #6
0
 protected TypePassthrough()
 {
     FixedTerminals.Add(new NodeTerminal(Direction.Input, NITypes.Void, "ref in"));
     FixedTerminals.Add(new NodeTerminal(Direction.Output, NITypes.Void, "ref out"));
 }
Пример #7
0
 private PrimitiveType()
 {
     FixedTerminals.Add(new NodeTerminal(Direction.Output, NITypes.Void, "type"));
 }