mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 05:27:43 +00:00
LibJS: Replace ASTNode::class_name() with RTTI
This is only used for debugging anyway, so performance doesn't matter too much.
This commit is contained in:
parent
647cfcb641
commit
4da913bfab
2 changed files with 11 additions and 117 deletions
|
@ -25,6 +25,7 @@
|
|||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <AK/Demangle.h>
|
||||
#include <AK/HashMap.h>
|
||||
#include <AK/HashTable.h>
|
||||
#include <AK/ScopeGuard.h>
|
||||
|
@ -51,6 +52,12 @@
|
|||
|
||||
namespace JS {
|
||||
|
||||
String ASTNode::class_name() const
|
||||
{
|
||||
// NOTE: We strip the "JS::" prefix.
|
||||
return demangle(typeid(*this).name()).substring(4);
|
||||
}
|
||||
|
||||
static void update_function_name(Value value, const FlyString& name, HashTable<JS::Cell*>& visited)
|
||||
{
|
||||
if (!value.is_object())
|
||||
|
@ -1155,7 +1162,7 @@ void NullLiteral::dump(int indent) const
|
|||
outln("null");
|
||||
}
|
||||
|
||||
void FunctionNode::dump(int indent, const char* class_name) const
|
||||
void FunctionNode::dump(int indent, const String& class_name) const
|
||||
{
|
||||
print_indent(indent);
|
||||
outln("{} '{}'", class_name, name());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue