"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.evaluateBundleSpec = evaluateBundleSpec;
exports.evaluateUnitBundleSpec = evaluateUnitBundleSpec;
exports.evaluateSpec = evaluateSpec;
exports.evaluateGraphUnitSpec = evaluateGraphUnitSpec;
const evaluateDataValue_1 = require("../evaluateDataValue");
const evaluateMemorySpec_1 = require("./evaluateMemorySpec");
function evaluateBundleSpec(bundle, specs, classes, resolver = () => {
    return undefined;
}) {
    evaluateSpec(bundle.spec, specs, classes, resolver);
    for (const specId in bundle.specs ?? {}) {
        const spec = bundle.specs[specId];
        evaluateSpec(spec, specs, classes, resolver);
    }
}
function evaluateUnitBundleSpec(bundle, specs, classes, resolver = () => {
    return undefined;
}) {
    (0, evaluateMemorySpec_1.evaluateMemorySpec)(bundle.unit.memory ?? {}, specs, classes, resolver);
}
function evaluateSpec(spec, specs, classes, resolver = () => {
    return undefined;
}) {
    for (const unitId in spec?.units ?? []) {
        const unit = spec.units[unitId];
        evaluateGraphUnitSpec(unit, specs, classes, resolver);
    }
}
function evaluateGraphUnitSpec(unit, specs, classes, resolver = () => {
    return undefined;
}) {
    if (unit.memory) {
        (0, evaluateMemorySpec_1.evaluateMemorySpec)(unit.memory, specs, classes, resolver);
    }
    const { input } = unit;
    for (const pinId in input) {
        const input_ = input[pinId];
        if (input_.data) {
            (0, evaluateDataValue_1.evaluateData)(input_.data, specs, classes, []);
        }
    }
}
//# sourceMappingURL=evaluateBundleSpec.js.map