// ===================================================================
        // COMMON INTERFACE FUNCTIONS
        // -------------------------------------------------------------------
        /// Resolves any dependencies that this code has.
        public override void ResolveDependencies()
        {
            // Optimize input parameters to fields/properties
            for (int i = 0; i < myParameters.Length; ++i)
            {
                var code         = myParameters[i];
                var producerCode = OptimizeInputParameter(code, myParent);
                if (producerCode != null)
                {
                    myParameters[i]     = producerCode;
                    producerCode.Parent = myParent;
                }
                myParameters[i].ResolveDependencies();
            }
            // -- Optimize target port from get fields/properties. --
            if (!IsStatic())
            {
                var targetPort = GraphInfo.GetTargetPort(VSObject);
                if (targetPort != null)
                {
                    var producerPort = GraphInfo.GetProducerPort(targetPort);
                    var producerCode = Context.GetCodeFor(producerPort.ParentNode);
                    if (producerCode is GetPropertyCallDefinition)
                    {
                        if (producerPort.ConsumerPorts.Length == 1)
                        {
                            myTargetCode = producerCode;
                            producerCode.Parent.Remove(producerCode);
                            producerCode.Parent = myParent;
                        }
                    }
                }
            }
            // Ask output objects to resolve their own child dependencies.
            foreach (var v in myOutputVariables)
            {
                v.ResolveDependencies();
            }
            if (myReturnVariable != null)
            {
                myReturnVariable.ResolveDependencies();

                // Return variable relocation
                var returnParent = GetProperParentForProducerPort(myReturnVariable);
                if (returnParent != null && returnParent != myParent)
                {
                    var returnPort = myReturnVariable.VSObject;
                    if (returnParent is ClassDefinition)
                    {
                        var v = new VariableDefinition(returnPort, returnParent, AccessSpecifier.Private, ScopeSpecifier.NonStatic);
                        returnParent.AddVariable(v);
                        myReturnVariable = null;
                        v.ResolveDependencies();
                    }
                }
            }
        }
        // -------------------------------------------------------------------------
        /// Generates the function call prefix code fragment.
        ///
        /// @param memberInfo The member information of the function to call.
        /// @param node Visual script function call node.
        /// @return The code fragment to prepend to the function call.
        ///
        protected string FunctionCallPrefix(iCS_EditorObject node)
        {
            var result = new StringBuilder(32);

            if (IsStatic())
            {
                if (!GraphInfo.IsLocalType(VSObject))
                {
                    result.Append(ToTypeName(node.RuntimeType));
                    result.Append(".");
                }
            }
            else
            {
                var thisPort = GraphInfo.GetTargetPort(node);
                if (thisPort != null)
                {
//					result.Append(GetExpressionFor(thisPort));
//					result.Append(".");
                    // -- Prepend target code producer if optimized. --
                    if (myTargetCode != null)
                    {
                        result.Append(myTargetCode.GenerateBody(0));
                        result.Append(".");
                        return(result.ToString());
                    }
                    var producerPort = GraphInfo.GetProducerPort(thisPort);
                    var producerType = Context.GetRuntimeTypeFor(producerPort);
                    var producerCode = Context.GetCodeFor(producerPort);
                    if (producerCode is FunctionDefinitionParameter)
                    {
                        var producerPortName = GetNameFor(producerPort);
                        if (producerPortName == null || producerPortName == "null")
                        {
                            Debug.LogWarning("producer port is null: " + producerPort.CodeName);
                        }
                        result.Append(GetNameFor(producerPort));
                        result.Append(".");
                    }
                    else if (producerCode is LocalVariableDefinition)
                    {
                        var producerPortName = Parent.GetLocalVariableName(producerPort);
                        if (producerPortName == null || producerPortName == "null")
                        {
                            Debug.LogWarning("producer port is null: " + producerPort.CodeName);
                        }
                        result.Append(producerPortName);
                        result.Append(".");
                    }
                    else if (producerPort.IsOwner)
                    {
                        if (producerType == typeof(Transform))
                        {
                            result.Append("transform.");
                        }
                        else if (producerType == typeof(GameObject))
                        {
                            result.Append("gameObject.");
                        }
                    }
                    else if (producerPort != thisPort)
                    {
                        var desiredType     = VSObject.RuntimeType;
                        var desiredTypeName = ToTypeName(desiredType);
                        var isUpcastNeeded  = producerType != desiredType && iCS_Types.IsA(producerType, desiredType);
                        if (isUpcastNeeded)
                        {
                            result.Append("(");
                        }
                        var producerNode = producerPort.ParentNode;
                        if (producerNode.IsConstructor)
                        {
                            result.Append(GetNameFor(producerNode));
                        }
                        else
                        {
                            result.Append(GetNameFor(producerPort));
                        }
                        if (isUpcastNeeded)
                        {
                            result.Append(" as ");
                            result.Append(desiredTypeName);
                            result.Append(")");
                        }
                        result.Append(".");
                    }
                }
            }
            return(result.ToString());
        }