summaryrefslogtreecommitdiff
path: root/src/emscripten-optimizer/simple_ast.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/emscripten-optimizer/simple_ast.cpp')
-rw-r--r--src/emscripten-optimizer/simple_ast.cpp14
1 files changed, 6 insertions, 8 deletions
diff --git a/src/emscripten-optimizer/simple_ast.cpp b/src/emscripten-optimizer/simple_ast.cpp
index 6afa0a66e..086d504ba 100644
--- a/src/emscripten-optimizer/simple_ast.cpp
+++ b/src/emscripten-optimizer/simple_ast.cpp
@@ -24,13 +24,11 @@ Ref& Ref::operator[](unsigned x) { return (*get())[x]; }
Ref& Ref::operator[](IString x) { return (*get())[x]; }
-bool Ref::operator==(const char* str) {
- return get()->isString() && !strcmp(get()->str.str, str);
+bool Ref::operator==(std::string_view str) {
+ return get()->isString() && get()->str == str;
}
-bool Ref::operator!=(const char* str) {
- return get()->isString() ? !!strcmp(get()->str.str, str) : true;
-}
+bool Ref::operator!=(std::string_view str) { return !(*this == str); }
bool Ref::operator==(const IString& str) {
return get()->isString() && get()->str == str;
@@ -81,8 +79,8 @@ void Value::stringify(std::ostream& os, bool pretty) {
}
switch (type) {
case String: {
- if (str.str) {
- os << '"' << str.str << '"';
+ if (str) {
+ os << '"' << str << '"';
} else {
os << "\"(null)\"";
}
@@ -147,7 +145,7 @@ void Value::stringify(std::ostream& os, bool pretty) {
}
}
indentify();
- os << '"' << i.first.c_str() << "\": ";
+ os << '"' << i.first << "\": ";
i.second->stringify(os, pretty);
}
if (pretty) {