Пример #1
0
        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);
        }
Пример #2
0
        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};");
                }
            }
        }
Пример #3
0
        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});");
                }
            }
        }
Пример #4
0
        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);
        }
Пример #5
0
        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";
            }
Пример #6
0
        private string GetOrCreateTypedPinName(NodeOutputDataPin pin)
        {
            string pinName = GetOrCreatePinName(pin);

            return($"{pin.PinType.Value.FullCodeName} {pinName}");
        }