Shovel.Instruction.ToString C# (CSharp) Method

ToString() public method

public ToString ( ) : string
return string
        public override string ToString()
        {
            var sb = new StringBuilder();
            if (this.Comments != null) {
                sb.Append (this.Comments);
            }
            if (this.Opcode == Opcodes.Label) {
                sb.AppendLine (this.Arguments.ToString().ToUpper() + ":");
            } else {
                sb.Append ("    ");
                sb.Append (this.Opcode.ToString().ToUpper());
                if (this.Arguments != null) {
                    sb.Append (" ");
                    if (this.Arguments is System.Collections.IEnumerable && !(this.Arguments is String)) {
                        var args = new List<string>();
                        foreach (var arg in (System.Collections.IEnumerable)this.Arguments) {
                            args.Add (arg.ToString());
                        }
                        sb.Append (String.Join (", ", args));
                    } else {
                        sb.Append (this.Arguments.ToString());
                    }
                }
                if (this.Opcode == Opcodes.Const && this.Arguments == null) {
                    sb.Append (" NULL");
                }
                sb.Append (System.Environment.NewLine);
            }
            return sb.ToString();
        }
Instruction