Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-72807

The arguments object's values is undefined in strict mode inside function expressions

    XMLWordPrintable

Details

    • 783ec60774a565f3a16c25af076b720de0e6acbd (qt/qtdeclarative/5.12)

    Description

      'use strict'; // causes problem
      
      function __min() {
          // arguments.length is always ok, but values (e.g. arguments[0]) is undefined (inside function expressions)
          return Math.min.apply(this, arguments);
      }
      
      var mins = [
        [1, 2, 3],
        [-2, 3, 1],
        [2, 3, 4]
      ].map(function (a) {
         return __min(a[0], a[1], a[2]);
      });
      
      function main() {
          console.log('main()',
              __min(1, 2, 3), // ok
              (function () { return __min(1, 2, 3); }()), // NaN
              mins // [NaN, NaN, NaN]
          );
      }
      

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            ulherman Ulf Hermann
            evg656e Evgeny
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes