var __extends = (this && this.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
import { CombinedAllNodeVisitor } from './CombinedAllNodeVisitor';
/**
 * Constructor.
 * @param {*} visitor
 * @class
 * @extends CombinedAllNodeVisitor
 * @author eric.wittmann@gmail.com
 */
var CombinedReverseTraverser = /** @class */ (function (_super) {
    __extends(CombinedReverseTraverser, _super);
    function CombinedReverseTraverser(visitor) {
        var _this = _super.call(this) || this;
        if (_this.visitor === undefined)
            _this.visitor = null;
        _this.visitor = visitor;
        return _this;
    }
    /**
     * @see io.apicurio.datamodels.core.visitors.ITraverser#traverse(io.apicurio.datamodels.core.models.Node)
     * @param {Node} node
     */
    CombinedReverseTraverser.prototype.traverse = function (node) {
        node.accept(this);
    };
    /**
     * @see io.apicurio.datamodels.combined.visitors.CombinedAllNodeVisitor#visitNode(io.apicurio.datamodels.core.models.Node)
     * @param {Node} node
     */
    CombinedReverseTraverser.prototype.visitNode = function (node) {
        node.accept(this.visitor);
        this.traverse(node.parent());
    };
    /**
     * @see io.apicurio.datamodels.combined.visitors.CombinedAllNodeVisitor#visitDocument(io.apicurio.datamodels.core.models.Document)
     * @param {Document} node
     */
    CombinedReverseTraverser.prototype.visitDocument = function (node) {
        node.accept(this.visitor);
    };
    return CombinedReverseTraverser;
}(CombinedAllNodeVisitor));
export { CombinedReverseTraverser };
CombinedReverseTraverser["__class"] = "io.apicurio.datamodels.combined.visitors.CombinedReverseTraverser";
CombinedReverseTraverser["__interfaces"] = ["io.apicurio.datamodels.core.visitors.IVisitor", "io.apicurio.datamodels.asyncapi.v2.visitors.IAai20Visitor", "io.apicurio.datamodels.openapi.v3.visitors.IOas30Visitor", "io.apicurio.datamodels.asyncapi.visitors.IAaiVisitor", "io.apicurio.datamodels.core.visitors.ITraverser", "io.apicurio.datamodels.openapi.v2.visitors.IOas20Visitor", "io.apicurio.datamodels.openapi.visitors.IOasVisitor"];
//# sourceMappingURL=CombinedReverseTraverser.js.map