Anforderungen  |   Konzepte  |   Entwurf  |   Entwicklung  |   Qualitätssicherung  |   Lebenszyklus  |   Steuerung
 
 
 
 


Quelle  get-bound-name.js   Sprache: JAVA

 
// Ensure JSOp::GetBoundName executes [[Has]], [[Get]], and [[Set]] the correct
// number of times.

function testInc() {
  function outer() {
    with (env) {
      // The inner function can be Warp-compiled, but has a with-environment
      // on its scope chain.
      return function() {
        // The increment operator is compiled to JSOp::GetBoundName.
        return ++prop;
      }
    }
  }

  var count_get = 0;
  var count_has = 0;
  var count_set = 0;

  function proxify(obj) {
    return new Proxy(obj, {
      get(t, pk, r) {
        count_get++;
        return Reflect.get(t, pk, r);
      },
      has(t, pk) {
        count_has++;
        return Reflect.has(t, pk);
      },
      set(t, pk, v, r) {
        count_set++;
        return Reflect.set(t, pk, v, r);
      },
    });
  }

  var count_unscopables = 0;

  var env = {
    get [Symbol.unscopables]() {
      count_unscopables++;
    },
    prop: 0,
  };
  env = proxify(env);

  var inner = outer();
  for (let i = 0; i < 200; ++i) {
    assertEq(inner(), i + 1);
  }

  assertEq(count_unscopables, 200);
  assertEq(count_has, 400);
  assertEq(count_get, 400);
  assertEq(count_set, 200);
}
testInc();

function testCompoundAssign() {
  function outer() {
    with (env) {
      // The inner function can be Warp-compiled, but has a with-environment
      // on its scope chain.
      return function() {
        // The compound assignment operator is compiled to JSOp::GetBoundName.
        return prop += 1;
      }
    }
  }

  var count_get = 0;
  var count_has = 0;
  var count_set = 0;

  function proxify(obj) {
    return new Proxy(obj, {
      get(t, pk, r) {
        count_get++;
        return Reflect.get(t, pk, r);
      },
      has(t, pk) {
        count_has++;
        return Reflect.has(t, pk);
      },
      set(t, pk, v, r) {
        count_set++;
        return Reflect.set(t, pk, v, r);
      },
    });
  }

  var count_unscopables = 0;

  var env = {
    get [Symbol.unscopables]() {
      count_unscopables++;
    },
    prop: 0,
  };
  env = proxify(env);

  var inner = outer();
  for (let i = 0; i < 200; ++i) {
    assertEq(inner(), i + 1);
  }

  assertEq(count_unscopables, 200);
  assertEq(count_has, 400);
  assertEq(count_get, 400);
  assertEq(count_set, 200);
}
testCompoundAssign();

Messung V0.5
C=95 H=96 G=95

¤ Dauer der Verarbeitung: 0.1 Sekunden  (vorverarbeitet)  ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

Beweissystem der NASA

Beweissystem Isabelle

NIST Cobol Testsuite

Cephes Mathematical Library

Wiener Entwicklungsmethode

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.






                                                                                                                                                                                                                                                                                                                                                                                                     


Neuigkeiten

     Aktuelles
     Motto des Tages

Software

     Produkte
     Quellcodebibliothek

Aktivitäten

     Artikel über Sicherheit
     Anleitung zur Aktivierung von SSL

Muße

     Gedichte
     Musik
     Bilder

Jenseits des Üblichen ....
    

Besucherstatistik

Besucherstatistik

Monitoring

Montastic status badge