From b8eea8f9f8922f883ad9e5a54c6d35183138ccc1 Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Wed, 28 Mar 2018 14:13:14 +0200 Subject: [PATCH] Locator/JavaScript: Fix min/max with more than 2 arguments MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Pass a variable amount of arguments along Task-number: QTCREATORBUG-20167 Change-Id: I3643aca8c18cba14beb8d625b62f45aa4b39d2a4 Reviewed-by: Orgad Shaneh Reviewed-by: André Hartmann --- doc/src/editors/creator-editors.qdoc | 8 ++++---- src/plugins/coreplugin/locator/javascriptfilter.cpp | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/doc/src/editors/creator-editors.qdoc b/doc/src/editors/creator-editors.qdoc index 658a4d686e2..603752dba8f 100644 --- a/doc/src/editors/creator-editors.qdoc +++ b/doc/src/editors/creator-editors.qdoc @@ -3112,11 +3112,11 @@ \li log(x) \li Returns the natural logarithm (base E) of x \row - \li max(x, y) - \li Returns the higher value of x and y + \li max([value1[, value2[, ...]]]) + \li Returns the highest value of the given numbers \row - \li min(x, y) - \li Returns the lower value of x and y + \li min([value1[, value2[, ...]]]) + \li Returns the lowest value of the given numbers \row \li oct(x) \li Returns the octal representation of x diff --git a/src/plugins/coreplugin/locator/javascriptfilter.cpp b/src/plugins/coreplugin/locator/javascriptfilter.cpp index 6f88a9188a2..58a119047bd 100644 --- a/src/plugins/coreplugin/locator/javascriptfilter.cpp +++ b/src/plugins/coreplugin/locator/javascriptfilter.cpp @@ -133,8 +133,8 @@ void JavaScriptFilter::setupEngine() "function floor(x) { return Math.floor(x); }\n" "function hex(x) { return '0x' + x.toString(16); }\n" "function log(x) { return Math.log(x); }\n" - "function max(x, y) { return Math.max(x, y); }\n" - "function min(x, y) { return Math.min(x, y); }\n" + "function max() { return Math.max.apply(null, arguments); }\n" + "function min() { return Math.min.apply(null, arguments); }\n" "function oct(x) { return '0' + x.toString(8); }\n" "function pi() { return Math.PI; }\n" "function pow(x, y) { return Math.pow(x, y); }\n"