"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.ManagedTest = exports.Test2 = exports.TestFunction = exports.TestFunctionCall = void 0;
const src_1 = require("../src");
const errors_1 = require("../src/utils/errors");
const managed_1 = require("../src/utils/managed");
function TestFunctionCall(a, s) {
    (0, src_1.traceFunction)(TestFunction, a, s);
}
exports.TestFunctionCall = TestFunctionCall;
// eslint-disable-next-line @typescript-eslint/no-empty-function, @typescript-eslint/no-unused-vars
function TestFunction(a, s) { }
exports.TestFunction = TestFunction;
class Test2 {
    async test2() {
        return 5;
    }
}
exports.Test2 = Test2;
let ManagedTest = class ManagedTest {
    constructor() {
        this.val = 3;
        console.log("ManagedTest Constructor");
    }
    get getter() {
        console.log("ManagedTest Getter");
        return 1;
    }
    get getterThrow() {
        console.log("GetterThrow");
        throw new Error("test crash");
        return 1;
    }
    set setter(a) {
        this.val = a;
    }
    set setterThrow(a) {
        throw new Error("test crash");
    }
    method(a, b) {
        return this.sum(a, this.mad(a, a, b));
    }
    // eslint-disable-next-line @typescript-eslint/no-unused-vars
    methodThrow(a, b) {
        throw new Error("test crash");
    }
    methodThrowMccError() {
        throw new errors_1.mccError(errors_1.mccErrorCode.InvalidData);
    }
    mad(a, b, c) {
        return a * b + c;
    }
    sum(a, b) {
        return a + b;
    }
    mul(a, b) {
        return a * b;
    }
    async asyncMethod(a, b) {
        return this.mul(this.sum(a, a), this.sum(b, b));
    }
    // eslint-disable-next-line @typescript-eslint/no-unused-vars
    async asyncMethodThrow(a, b) {
        throw new Error("test crash");
    }
    // async nested test
    async asyncNestedMethod() {
        const promises = [];
        for (let a = 0; a < 10; a++) {
            promises.push(this.asyncMethod3(a));
        }
        return promises;
    }
    async asyncNestedMethodAwait() {
        for (let a = 0; a < 10; a++) {
            await this.asyncMethod3(a);
        }
    }
    async asyncNestedMethodWaitOnEnd() {
        const promises = [];
        for (let a = 0; a < 3; a++) {
            promises.push(this.asyncMethod3(a));
        }
        await Promise.all(promises);
    }
    async asyncMethod3(a) {
        for (let i = 0; i < 3; i++) {
            this.f0(a, i);
            await (0, src_1.sleepMs)(10);
        }
    }
    // eslint-disable-next-line @typescript-eslint/no-empty-function, @typescript-eslint/no-unused-vars
    f0(a, b) { }
    //
    f1(param) {
        this.f2(`f1(${param})->f2`);
        this.f3(`f1(${param})->f3`);
    }
    f2(param) {
        this.f3(`f2(${param})->f3`);
    }
    f3(param) {
        for (let a = 0; a < 3; a++) {
            this.f4(`f3(${param})->f4(${a})`);
        }
    }
    // eslint-disable-next-line @typescript-eslint/no-unused-vars, @typescript-eslint/no-empty-function
    f4(param) { }
};
ManagedTest = __decorate([
    (0, managed_1.Managed)()
], ManagedTest);
exports.ManagedTest = ManagedTest;
//# sourceMappingURL=managedTest.js.map