From 3fb0ff102c4cd3611ce60b99ddebce013333d7fc Mon Sep 17 00:00:00 2001 From: 0xtechnobabble <0xtechnobabble@protonmail.com> Date: Sun, 8 Mar 2020 08:00:22 +0200 Subject: [PATCH] LibJS: Allow the dumping of literals that aren't numbers --- Libraries/LibJS/AST.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Libraries/LibJS/AST.cpp b/Libraries/LibJS/AST.cpp index 11f359fd27..7005343bb7 100644 --- a/Libraries/LibJS/AST.cpp +++ b/Libraries/LibJS/AST.cpp @@ -138,7 +138,13 @@ void CallExpression::dump(int indent) const void Literal::dump(int indent) const { print_indent(indent); - printf("%d\n", (i32)m_value.as_double()); + if (m_value.is_object()) + ASSERT_NOT_REACHED(); + + if (m_value.is_string()) + printf("%s\n", m_value.as_string()->characters()); + else + printf("%s\n", m_value.to_string().characters()); } void FunctionDeclaration::dump(int indent) const