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

Type error thrown when assigning to properties of a WeakMap

    XMLWordPrintable

Details

    Description

      In strict mode, the following code produces a type error, when executed from QML (by imorting a .js file or by having it directly in a .qml file):

      var foo = new WeakMap();
      foo.set = ...; // <- TypeError
      

      The code seems to fail on a `SetLookup` instruction for the assignment, producing a `TypeError` when in strict mode:

          MOTH_BEGIN_INSTR(SetLookup)
              STORE_IP();
              STORE_ACC();
              QV4::Lookup *l = function->executableCompilationUnit()->runtimeLookups + index;
              if (!l->setter(l, engine, STACK_VALUE(base), accumulator) && function->isStrict())
                  engine->throwTypeError(); // <- Here
              CHECK_EXCEPTION;
          MOTH_END_INSTR(SetLookup)
      

      This seems specific to the usage of `WeakMap` as the same code doesn't produce an error when used, for example, with an `Array`.

      Attachments

        Issue Links

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

          Activity

            People

              diseraluca Luca Di Sera
              diseraluca Luca Di Sera
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes