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")); }
protected FunctionalNode(NIType signature) { Signature = signature; foreach (NodeTerminal terminal in CreateNodeTerminalsFromSignature(signature)) { FixedTerminals.Add(terminal); } Width = StockDiagramGeometries.GridSize * 4; }
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); }
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(); } }
protected DropNode() { FixedTerminals.Add(new NodeTerminal(Direction.Input, PFTypes.Void, "value")); }
protected TypePassthrough() { FixedTerminals.Add(new NodeTerminal(Direction.Input, NITypes.Void, "ref in")); FixedTerminals.Add(new NodeTerminal(Direction.Output, NITypes.Void, "ref out")); }
private PrimitiveType() { FixedTerminals.Add(new NodeTerminal(Direction.Output, NITypes.Void, "type")); }