Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/C/Firefox/js/src/jit-test/lib/   (Browser von der Mozilla Stiftung Version 136.0.1©)  Datei vom 10.2.2025 mit Größe 1 kB image not shown  

Impressum match-debugger.js   Sprache: JAVA

 
// Debugger-oriented Pattern subclasses.

if (typeof Match !== 'function') {
  load(libdir + 'match.js');
}

class DebuggerObjectPattern extends Match.Pattern {
  constructor(className, props) {
    super();
    this.className = className;
    if (props) {
      this.props = Match.Pattern.OBJECT_WITH_EXACTLY(props);
    }
  }

  match(actual) {
    if (!(actual instanceof Debugger.Object)) {
      throw new Match.MatchError(`Expected Debugger.Object, got ${actual}`);
    }

    if (actual.class !== this.className) {
      throw new Match.MatchError(`Expected Debugger.Object of class ${this.className}, got Debugger.Object of class ${actual.class}`);
    }

    if (this.props !== undefined) {
      const lifted = {};
      for (const name of actual.getOwnPropertyNames()) {
        const desc = actual.getOwnPropertyDescriptor(name);
        if (!('value' in desc)) {
          throw new Match.MatchError(`Debugger.Object referent has non-value property ${JSON.stringify(name)}`);
        }
        lifted[name] = desc.value;
      }

      try {
        this.props.match(lifted);
      } catch (inner) {
        if (!(inner instanceof Match.MatchError)) {
          throw inner;
        }
        inner.message = `matching Debugger.Object referent properties:\n${inner.message}`;
        throw inner;
      }
    }

    return true;
  }
}

// The Debugger API guarantees that various sorts of meta-objects are 1:1 with
// their referents, so it's often useful to check that two objects are === in
// patterns.
class DebuggerIdentical extends Match.Pattern {
  constructor(expected) {
    super();
    this.expected = expected;
  }

  match(actual) {
    if (actual !== this.expected) {
      throw new Pattern.MatchError(`Expected exact value ${uneval(this.expected)}, got ${uneval(actual)}`);
    }
  }
}

Messung V0.5
C=91 H=99 G=94

¤ Dauer der Verarbeitung: 0.12 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.