From 17e71f88011c8c04350d38e999ac9047152e7325 Mon Sep 17 00:00:00 2001 From: "Jay Freeman (saurik)" Date: Sun, 3 Jan 2016 13:42:30 -0800 Subject: [PATCH] Do not output class extension syntax for Object{}. --- Execute.cpp | 7 +++++-- String.hpp | 5 +++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/Execute.cpp b/Execute.cpp index e11542a..52bc453 100644 --- a/Execute.cpp +++ b/Execute.cpp @@ -517,8 +517,11 @@ const char *CYPoolCCYON(CYPool &pool, JSContextRef context, JSObjectRef object, if (CYIsStrictEqual(context, theory, practice)) { JSValueRef name(CYGetProperty(context, constructor, name_s)); - if (!JSValueIsUndefined(context, name)) - str << "new" << ' ' << CYPoolUTF8String(pool, context, CYJSString(context, name)); + if (!JSValueIsUndefined(context, name)) { + auto utf8(CYPoolUTF8String(pool, context, CYJSString(context, name))); + if (utf8 != "Object") + str << "new" << ' ' << utf8; + } } } diff --git a/String.hpp b/String.hpp index 14599fb..75e659c 100644 --- a/String.hpp +++ b/String.hpp @@ -54,6 +54,11 @@ struct CYUTF8String { return length == size && memcmp(value, data, length) == 0; } + bool operator !=(const char *value) const { + size_t length(strlen(data)); + return length != size || memcmp(value, data, length) != 0; + } + operator std::string() const { return std::string(data, size); } -- 2.45.2