示例#1
0
        /// <inheritdoc />
        public IDictionary <string, string> GetEdgeAttributes(IEdge edge, long sourceId, long targetId)
        {
            if (edge is DataFlowEdge <TContents> e)
            {
                var result = new Dictionary <string, string>();

                (var style, string label) = e.DataSource switch
                {
                    StackDataSource <TContents> source => (StackDependencyStyle, source.SlotIndex.ToString()),
                    VariableDataSource <TContents> source => (VariableDependencyStyle, source.Variable.Name),
                    _ => default
                };

                if (!string.IsNullOrEmpty(style.Color))
                {
                    result["color"] = style.Color;
                }
                if (!string.IsNullOrEmpty(style.Style))
                {
                    result["style"] = style.Style;
                }
                if (!string.IsNullOrEmpty(label))
                {
                    result["label"] = label;
                }

                return(result);
            }

            return(null);
        }
示例#2
0
        private IVariable GetStackSlot(StackDataSource <TInstruction> dataSource)
        {
            var node = dataSource.Node;

            if (node is ExternalDataSourceNode <TInstruction> external)
            {
                return(_context.GetExternalVariable(external));
            }

            return(_context.StackSlots[node.Contents][dataSource.SlotIndex]);
        }