"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;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
Object.defineProperty(exports, "__esModule", { value: true });
require("reflect-metadata");
const ModelDecorators_1 = require("../ModelDecorators");
const mobx_1 = require("mobx");
class ModelContext {
}
__decorate([
    mobx_1.observable,
    __metadata("design:type", Expression)
], ModelContext.prototype, "root", void 0);
exports.ModelContext = ModelContext;
class Expression {
    constructor(name) {
        this.name = name;
    }
    toString() {
        return "Expression '" + this.name + "'";
    }
    text() {
        return this.name;
    }
}
exports.Expression = Expression;
class BinExpression extends Expression {
    constructor(name) {
        super(name);
    }
}
__decorate([
    ModelDecorators_1.part,
    __metadata("design:type", Expression)
], BinExpression.prototype, "left", void 0);
__decorate([
    ModelDecorators_1.part,
    __metadata("design:type", Expression)
], BinExpression.prototype, "right", void 0);
__decorate([
    ModelDecorators_1.listpart,
    __metadata("design:type", Array)
], BinExpression.prototype, "somes", void 0);
exports.BinExpression = BinExpression;
function printExp(exp, indent) {
    if (exp instanceof BinExpression) {
        console.log(indent + exp.name);
        printExp(exp.left, indent + "    ");
        printExp(exp.right, indent + "    ");
        exp.somes.forEach(s => {
            printExp(s, indent + " s  ");
        });
    }
    else if (exp instanceof Expression) {
        const cont = exp.container;
        console.log(indent + exp.name + " => " + (cont ? cont.name : "null") + " : " + exp.propertyName + "[" + exp.propertyIndex + "]");
    }
}
exports.printExp = printExp;
//# sourceMappingURL=Model.js.map