Ejemplo n.º 1
0
        private void WritePropertyValue(TextWriter writer, Stack <RuntimeObject> stack, EcmaValue value)
        {
            switch (value.Type)
            {
            case EcmaValueType.Null:
                writer.Write("null");
                break;

            case EcmaValueType.Boolean:
                writer.Write(value.ToBoolean() ? "true" : "false");
                break;

            case EcmaValueType.Number:
                writer.Write(value.IsFinite ? value.ToString() : "null");
                break;

            case EcmaValueType.String:
                WriteString(writer, value.ToString());
                break;

            case EcmaValueType.Object:
                if (!value.IsCallable)
                {
                    if (EcmaArray.IsArray(value))
                    {
                        SerializeJsonArray(writer, stack, value.ToObject());
                    }
                    else
                    {
                        SerializeJsonObject(writer, stack, value.ToObject());
                    }
                }
                break;
            }
        }