From 40b629641be3a10385a6861fe3367aae2af17d43 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sun, 22 Oct 2017 18:01:04 +0200 Subject: [PATCH] Don't define "objElements" in JavaScript code unless we need it This variable is only used when dumping object fields, so define it there both as a micro-optimization and for clarity. --- include/wx/private/jsscriptwrapper.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/wx/private/jsscriptwrapper.h b/include/wx/private/jsscriptwrapper.h index 0477df07a6..7fd036302a 100644 --- a/include/wx/private/jsscriptwrapper.h +++ b/include/wx/private/jsscriptwrapper.h @@ -84,7 +84,6 @@ public: "catch (e) {" "try {" "function __wx$stringifyJSON(obj) {" - "var objElements = [];" "if (!(obj instanceof Object))" "return typeof obj === \"string\"" "? \'\"\' + obj + \'\"\'" @@ -122,6 +121,7 @@ public: "}" "return '\"' + obj.toISOString(); + '\"'" "}" + "var objElements = [];" "for (var key in obj)" "{" "if (typeof obj[key] === \"function\")"