"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const ast_1 = require("../ast");
function* getFinalStatements(node) {
    if (ast_1.BlockStatement.is(node)) {
        let last = node.body[node.body.length - 1];
        yield* getFinalStatements(last);
    }
    else if (ast_1.IfStatement.is(node)) {
        yield* getFinalStatements(node.consequent);
        if (node.alternate) {
            yield* getFinalStatements(node.alternate);
        }
    }
    else {
        yield node;
    }
}
exports.default = getFinalStatements;
