From 77f36a9e4690d9bf28ea237bc9616f6709a03979 Mon Sep 17 00:00:00 2001 From: Dan Klishch Date: Mon, 13 Nov 2023 21:55:18 -0500 Subject: [PATCH] LibJS: Remove redundant use of JsonValue::{is,as}_i32() Value::Value(double) already converts double to int when it is safe, no need to check for this here explicitly. While this technically removes an optimization, I doubt that it will regress performance in any measurable way. --- Userland/Libraries/LibJS/Runtime/JSONObject.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/Userland/Libraries/LibJS/Runtime/JSONObject.cpp b/Userland/Libraries/LibJS/Runtime/JSONObject.cpp index d723ff4c430..782abf8af41 100644 --- a/Userland/Libraries/LibJS/Runtime/JSONObject.cpp +++ b/Userland/Libraries/LibJS/Runtime/JSONObject.cpp @@ -434,8 +434,6 @@ Value JSONObject::parse_json_value(VM& vm, JsonValue const& value) return Value(parse_json_array(vm, value.as_array())); if (value.is_null()) return js_null(); - if (value.is_i32()) - return Value(value.as_i32()); if (value.is_number()) return Value(value.to_double(0)); if (value.is_string())