@informalsystems/quint
Version:
Core tool for the Quint specification language
45 lines • 1.49 kB
JavaScript
;
/* ----------------------------------------------------------------------------------
* Copyright 2024 Informal Systems
* Licensed under the Apache License, Version 2.0.
* See LICENSE in the project root for license information.
* --------------------------------------------------------------------------------- */
Object.defineProperty(exports, "__esModule", { value: true });
exports.Trace = void 0;
/**
* Trace of states representing a single execution path
*
* @author Gabriela Moreira
*
* @module
*/
const immutable_1 = require("immutable");
const runtimeValueDiff_1 = require("./runtimeValueDiff");
const prettierimp_1 = require("../../prettierimp");
class Trace {
constructor() {
this.states = (0, immutable_1.List)();
}
get() {
return this.states.toArray();
}
reset(values = []) {
this.states = (0, immutable_1.List)(values);
}
extend(state) {
this.states = this.states.push(state);
}
dropLast() {
this.states = this.states.pop();
}
renderDiff(width, config) {
if (this.states.size == 0) {
return '';
}
const comparisonBase = this.states.size > 1 ? this.states.get(this.states.size - 2) : this.states.last();
const doc = (0, runtimeValueDiff_1.diffRuntimeValueDoc)(comparisonBase, this.states.last(), config);
return (0, prettierimp_1.format)(width, 0, doc);
}
}
exports.Trace = Trace;
//# sourceMappingURL=trace.js.map