Exemple #1
0
        private void GenerateStructureValueCode(AstValueStructure valueInfo)
        {
            ActiveFileTextComposer.Append("new ");
            ActiveFileTextComposer.Append(valueInfo.Structure.AssociatedStructure.SymbolAccessName);
            ActiveFileTextComposer.AppendLine("()");
            ActiveFileTextComposer.AppendLine("{");
            ActiveFileTextComposer.IncreaseIndentation();

            //Generate structure members initialization code
            var firstFlag = true;

            foreach (var termInfo in valueInfo.Terms)
            {
                if (firstFlag)
                {
                    firstFlag = false;
                }
                else
                {
                    ActiveFileTextComposer.AppendLine(",");
                }

                ActiveFileTextComposer.Append(termInfo.DataMemberName);
                ActiveFileTextComposer.Append(" = ");
                GenerateValueCode(termInfo.DataMemberValue);
            }
            ActiveFileTextComposer.AppendLine();

            ActiveFileTextComposer.DecreaseIndentation();
            ActiveFileTextComposer.Append("}");
        }
Exemple #2
0
        public void Visit(AstValueStructure expr)
        {
            var dict =
                expr.Terms.ToDictionary(term => term.DataMemberName, term => term.DataMemberName);

            var node =
                StepsCluster
                .AddNode(NodeInfo.NodeName)
                .SetLabel(
                    Graph.Table(
                        "Structure",
                        Graph.SimpleTable(expr.Structure.AccessName, "Value"),
                        Graph.SimpleTable(dict)
                        )
                    );

            foreach (var term in expr.Terms)
            {
                FollowExpression(term.DataMemberValue, node.ToNodeRef(term.DataMemberName, DotCompass.West));
            }
        }