public virtual void write(object k, object v) { unchecked { if ((this.replacer != null)) { v = ((object)(this.replacer.__hx_invoke2_o(default(double), k, default(double), v))); } { global::ValueType _g = global::Type.@typeof(v); switch (_g.index) { case 0: { this.buf.b.Append(((string)("null"))); break; } case 1: { this.buf.b.Append(((string)(global::Std.@string(global::haxe.lang.Runtime.toString(v))))); break; } case 2: { string v1 = null; double f = ((double)(global::haxe.lang.Runtime.toDouble(v))); if ((!(global::System.Double.IsInfinity(((double)(f)))) && !(global::System.Double.IsNaN(((double)(f)))))) { v1 = global::haxe.lang.Runtime.toString(v); } else { v1 = "null"; } this.buf.b.Append(((string)(global::Std.@string(v1)))); break; } case 3: { this.buf.b.Append(((string)(global::Std.@string(global::haxe.lang.Runtime.toString(v))))); break; } case 4: { this.fieldsString(v, global::Reflect.fields(v)); break; } case 5: { this.buf.b.Append(((string)("\"<fun>\""))); break; } case 6: { global::System.Type c = ((global::System.Type)(_g.@params[0])); if (global::haxe.lang.Runtime.refEq(c, typeof(string))) { this.quote(global::haxe.lang.Runtime.toString(v)); } else if (global::haxe.lang.Runtime.refEq(c, typeof(global::Array <object>))) { global::Array v2 = ((global::Array)(v)); this.buf.b.Append(((char)(91))); int len = ((int)(global::haxe.lang.Runtime.getField_f(v2, "length", 520590566, true))); int last = (len - 1); { int _g1 = 0; int _g2 = len; while ((_g1 < _g2)) { int i = _g1++; if ((i > 0)) { this.buf.b.Append(((char)(44))); } else { this.nind++; } if (this.pretty) { this.buf.b.Append(((char)(10))); } if (this.pretty) { string v3 = global::StringTools.lpad("", this.indent, (this.nind * this.indent.Length)); this.buf.b.Append(((string)(global::Std.@string(v3)))); } this.write(i, v2[i]); if ((i == last)) { this.nind--; if (this.pretty) { this.buf.b.Append(((char)(10))); } if (this.pretty) { string v4 = global::StringTools.lpad("", this.indent, (this.nind * this.indent.Length)); this.buf.b.Append(((string)(global::Std.@string(v4)))); } } } } this.buf.b.Append(((char)(93))); } else if (global::haxe.lang.Runtime.refEq(c, typeof(global::haxe.ds.StringMap <object>))) { global::haxe.ds.StringMap v5 = ((global::haxe.ds.StringMap)(v)); object o = new global::haxe.lang.DynamicObject(new int[] {}, new object[] {}, new int[] {}, new double[] {}); { object k1 = ((object)(new global::haxe.ds._StringMap.StringMapKeyIterator <object>(((global::haxe.ds.StringMap <object>)(global::haxe.ds.StringMap <object> .__hx_cast <object>(((global::haxe.ds.StringMap)(v5)))))))); while (global::haxe.lang.Runtime.toBool(global::haxe.lang.Runtime.callField(k1, "hasNext", 407283053, null))) { string k2 = global::haxe.lang.Runtime.toString(global::haxe.lang.Runtime.callField(k1, "next", 1224901875, null)); global::Reflect.setField(o, k2, ((object)(global::haxe.lang.Runtime.callField(v5, "get", 5144726, new global::Array <object>(new object[] { k2 }))))); } } this.fieldsString(o, global::Reflect.fields(o)); } else if (global::haxe.lang.Runtime.refEq(c, typeof(global::Date))) { global::Date v6 = ((global::Date)(v)); this.quote(v6.toString()); } else { this.fieldsString(v, global::Reflect.fields(v)); } break; } case 7: { object i1 = global::Type.enumIndex(v); this.buf.b.Append(((string)(global::Std.@string(global::haxe.lang.Runtime.toString(i1))))); break; } case 8: { this.buf.b.Append(((string)("\"???\""))); break; } } } } }
public virtual void write(object k, object v) { unchecked { #line 82 "/opt/haxe/std/haxe/format/JsonPrinter.hx" if ((this.replacer != null)) { #line 83 "/opt/haxe/std/haxe/format/JsonPrinter.hx" v = ((object)(this.replacer.__hx_invoke2_o(default(double), k, default(double), v))); } #line 84 "/opt/haxe/std/haxe/format/JsonPrinter.hx" { #line 84 "/opt/haxe/std/haxe/format/JsonPrinter.hx" global::ValueType _g = global::Type.@typeof(v); #line 84 "/opt/haxe/std/haxe/format/JsonPrinter.hx" switch (_g._hx_index) { case 0: { #line 136 "/opt/haxe/std/haxe/format/JsonPrinter.hx" this.buf.b.Append(((string)("null"))); #line 136 "/opt/haxe/std/haxe/format/JsonPrinter.hx" break; } case 1: { #line 90 "/opt/haxe/std/haxe/format/JsonPrinter.hx" this.buf.b.Append(((string)(global::Std.@string(global::haxe.lang.Runtime.toString(v))))); #line 90 "/opt/haxe/std/haxe/format/JsonPrinter.hx" break; } case 2: { #line 92 "/opt/haxe/std/haxe/format/JsonPrinter.hx" double f = ((double)(global::haxe.lang.Runtime.toDouble(v))); #line 92 "/opt/haxe/std/haxe/format/JsonPrinter.hx" string v1 = (((!(global::System.Double.IsInfinity(((double)(f)))) && !(global::System.Double.IsNaN(((double)(f)))))) ? (global::Std.@string(v)) : ("null")); #line 92 "/opt/haxe/std/haxe/format/JsonPrinter.hx" this.buf.b.Append(((string)(global::Std.@string(v1)))); #line 92 "/opt/haxe/std/haxe/format/JsonPrinter.hx" break; } case 3: { #line 134 "/opt/haxe/std/haxe/format/JsonPrinter.hx" this.buf.b.Append(((string)(global::Std.@string(global::haxe.lang.Runtime.toString(v))))); #line 134 "/opt/haxe/std/haxe/format/JsonPrinter.hx" break; } case 4: { #line 88 "/opt/haxe/std/haxe/format/JsonPrinter.hx" this.fieldsString(v, global::Reflect.fields(v)); #line 88 "/opt/haxe/std/haxe/format/JsonPrinter.hx" break; } case 5: { #line 94 "/opt/haxe/std/haxe/format/JsonPrinter.hx" this.buf.b.Append(((string)("\"<fun>\""))); #line 94 "/opt/haxe/std/haxe/format/JsonPrinter.hx" break; } case 6: { #line 95 "/opt/haxe/std/haxe/format/JsonPrinter.hx" global::System.Type c = (_g as global::ValueType_TClass).c; if (global::haxe.lang.Runtime.refEq(c, typeof(string))) { #line 97 "/opt/haxe/std/haxe/format/JsonPrinter.hx" this.quote(global::haxe.lang.Runtime.toString(v)); } else if (global::haxe.lang.Runtime.refEq(c, typeof(global::Array <object>))) { #line 99 "/opt/haxe/std/haxe/format/JsonPrinter.hx" global::Array v2 = ((global::Array)(v)); this.buf.addChar(91); #line 102 "/opt/haxe/std/haxe/format/JsonPrinter.hx" int len = ((int)(global::haxe.lang.Runtime.getField_f(v2, "length", 520590566, true))); int last = (len - 1); #line 104 "/opt/haxe/std/haxe/format/JsonPrinter.hx" { #line 104 "/opt/haxe/std/haxe/format/JsonPrinter.hx" int _g1 = 0; #line 104 "/opt/haxe/std/haxe/format/JsonPrinter.hx" int _g2 = len; #line 104 "/opt/haxe/std/haxe/format/JsonPrinter.hx" while ((_g1 < _g2)) { #line 104 "/opt/haxe/std/haxe/format/JsonPrinter.hx" int i = _g1++; if ((i > 0)) { #line 106 "/opt/haxe/std/haxe/format/JsonPrinter.hx" this.buf.addChar(44); } else { #line 108 "/opt/haxe/std/haxe/format/JsonPrinter.hx" this.nind++; } #line 109 "/opt/haxe/std/haxe/format/JsonPrinter.hx" if (this.pretty) { #line 109 "/opt/haxe/std/haxe/format/JsonPrinter.hx" this.buf.addChar(10); } #line 110 "/opt/haxe/std/haxe/format/JsonPrinter.hx" if (this.pretty) { #line 110 "/opt/haxe/std/haxe/format/JsonPrinter.hx" string v3 = global::StringTools.lpad("", this.indent, (this.nind * this.indent.Length)); #line 110 "/opt/haxe/std/haxe/format/JsonPrinter.hx" this.buf.b.Append(((string)(global::Std.@string(v3)))); } #line 111 "/opt/haxe/std/haxe/format/JsonPrinter.hx" this.write(i, v2[i]); if ((i == last)) { #line 113 "/opt/haxe/std/haxe/format/JsonPrinter.hx" this.nind--; if (this.pretty) { #line 114 "/opt/haxe/std/haxe/format/JsonPrinter.hx" this.buf.addChar(10); } #line 115 "/opt/haxe/std/haxe/format/JsonPrinter.hx" if (this.pretty) { #line 115 "/opt/haxe/std/haxe/format/JsonPrinter.hx" string v4 = global::StringTools.lpad("", this.indent, (this.nind * this.indent.Length)); #line 115 "/opt/haxe/std/haxe/format/JsonPrinter.hx" this.buf.b.Append(((string)(global::Std.@string(v4)))); } } } } #line 118 "/opt/haxe/std/haxe/format/JsonPrinter.hx" this.buf.addChar(93); } else if (global::haxe.lang.Runtime.refEq(c, typeof(global::haxe.ds.StringMap <object>))) { #line 120 "/opt/haxe/std/haxe/format/JsonPrinter.hx" global::haxe.ds.StringMap v5 = ((global::haxe.ds.StringMap)(v)); object o = new global::haxe.lang.DynamicObject(new int[] {}, new object[] {}, new int[] {}, new double[] {}); #line 122 "/opt/haxe/std/haxe/format/JsonPrinter.hx" { #line 122 "/opt/haxe/std/haxe/format/JsonPrinter.hx" object k1 = ((object)(new global::haxe.ds._StringMap.StringMapKeyIterator <object>(((global::haxe.ds.StringMap <object>)(global::haxe.ds.StringMap <object> .__hx_cast <object>(((global::haxe.ds.StringMap)(v5)))))))); #line 122 "/opt/haxe/std/haxe/format/JsonPrinter.hx" while (global::haxe.lang.Runtime.toBool(global::haxe.lang.Runtime.callField(k1, "hasNext", 407283053, null))) { #line 122 "/opt/haxe/std/haxe/format/JsonPrinter.hx" string k2 = global::haxe.lang.Runtime.toString(global::haxe.lang.Runtime.callField(k1, "next", 1224901875, null)); global::Reflect.setField(o, k2, ((object)(global::haxe.lang.Runtime.callField(v5, "get", 5144726, new object[] { k2 })))); } } #line 124 "/opt/haxe/std/haxe/format/JsonPrinter.hx" { #line 124 "/opt/haxe/std/haxe/format/JsonPrinter.hx" object v6 = ((object)(o)); #line 124 "/opt/haxe/std/haxe/format/JsonPrinter.hx" this.fieldsString(v6, global::Reflect.fields(v6)); } } else if (global::haxe.lang.Runtime.refEq(c, typeof(global::Date))) { #line 126 "/opt/haxe/std/haxe/format/JsonPrinter.hx" global::Date v7 = ((global::Date)(v)); this.quote(v7.toString()); } else { #line 129 "/opt/haxe/std/haxe/format/JsonPrinter.hx" this.classString(v); } #line 95 "/opt/haxe/std/haxe/format/JsonPrinter.hx" break; } case 7: { #line 130 "/opt/haxe/std/haxe/format/JsonPrinter.hx" global::System.Type _g3 = (_g as global::ValueType_TEnum).e; #line 130 "/opt/haxe/std/haxe/format/JsonPrinter.hx" { #line 131 "/opt/haxe/std/haxe/format/JsonPrinter.hx" object i1 = global::Type.enumIndex(v); this.buf.b.Append(((string)(global::Std.@string(global::haxe.lang.Runtime.toString(i1))))); } #line 130 "/opt/haxe/std/haxe/format/JsonPrinter.hx" break; } case 8: { #line 86 "/opt/haxe/std/haxe/format/JsonPrinter.hx" this.buf.b.Append(((string)("\"???\""))); #line 86 "/opt/haxe/std/haxe/format/JsonPrinter.hx" break; } } } } #line default }