예제 #1
0
            public void Demangle(DemanglingContext context)
            {
                SimpleOperatorName question = OperatorName as SimpleOperatorName;

                if (question.Value == SimpleOperatorName.Values.Question)
                {
                    FirstExpression.Demangle(context);
                    context.Writer.Append(" ? ");
                    SecondExpression.Demangle(context);
                    context.Writer.Append(" : ");
                    ThirdExpression.Demangle(context);
                }
                else
                {
                    // Nonsensical ternary operator? Just print it like a function call,
                    // I suppose...
                    //
                    // TODO: should we detect and reject this during parsing?
                    OperatorName.Demangle(context);
                    context.Writer.Append("(");
                    FirstExpression.Demangle(context);
                    context.Writer.Append(", ");
                    SecondExpression.Demangle(context);
                    context.Writer.Append(", ");
                    ThirdExpression.Demangle(context);
                    context.Writer.Append(")");
                }
            }
예제 #2
0
 public void Demangle(DemanglingContext context)
 {
     context.Writer.Append("(");
     FirstExpression.Demangle(context);
     context.Writer.Append(")");
     OperatorName.Demangle(context);
     context.Writer.Append("(");
     SecondExpression.Demangle(context);
     context.Writer.Append(")");
 }