private string GetOrCreatePinName(NodeOutputDataPin pin) { // Return the default value of the pin type if nothing is connected if (pin == null) { return("null"); } if (variableNames.ContainsKey(pin)) { return(variableNames[pin]); } string pinName; // Special case for property setters, input name "value". // TODO: Don't rely on set_ prefix if (pin.Node is EntryNode && method.Name.StartsWith("set_")) { pinName = "value"; } else { pinName = TranslatorUtil.GetUniqueVariableName(pin.Name.Replace("<", "_").Replace(">", "_"), variableNames.Values.ToList()); } variableNames.Add(pin, pinName); return(pinName); }
private void TranslateVariables() { foreach (var v in variableNames) { NodeOutputDataPin pin = v.Key; string variableName = v.Value; if (!(pin.Node is EntryNode)) { builder.AppendLine($"{pin.PinType} {variableName};"); } } }
private void TranslateVariables() { builder.AppendLine("// Variables"); foreach (var v in variableNames) { NodeOutputDataPin pin = v.Key; string variableName = v.Value; if (!(pin.Node is EntryNode)) { builder.AppendLine($"{pin.PinType.Value.FullCodeName} {variableName} = default({pin.PinType.Value.FullCodeName});"); } } }
private string GetOrCreatePinName(NodeOutputDataPin pin) { // Return the default value of the pin type if nothing is connected if (pin == null) { return("null"); } if (variableNames.ContainsKey(pin)) { return(variableNames[pin]); } string pinName = TranslatorUtil.GetUniqueVariableName(pin.Name, variableNames.Values.ToList()); variableNames.Add(pin, pinName); return(pinName); }
private string GetOrCreatePinName(NodeOutputDataPin pin) { // Return the default value of the pin type if nothing is connected if (pin == null) { return("null"); } if (variableNames.ContainsKey(pin)) { return(variableNames[pin]); } string pinName; // Special case for property setters, input name "value". // TODO: Don't rely on set_ prefix // TODO: Use PropertyGraph instead of MethodGraph if (pin.Node is MethodEntryNode && graph is MethodGraph methodGraph && methodGraph.Name.StartsWith("set_")) { pinName = "value"; }
private string GetOrCreateTypedPinName(NodeOutputDataPin pin) { string pinName = GetOrCreatePinName(pin); return($"{pin.PinType.Value.FullCodeName} {pinName}"); }