"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 });
const language_1 = require("../../../language");
const CoreTestExpression_1 = require("./CoreTestExpression");
const CoreTestVariable_1 = require("../domain/CoreTestVariable");
const CoreTestAttribute_1 = require("../domain/CoreTestAttribute");
let CoreTestFunctionDeclaration = class CoreTestFunctionDeclaration {
    constructor(name) {
        this.name = name;
        this.$typename = "CoreTestAbsExpression";
    }
};
CoreTestFunctionDeclaration = __decorate([
    language_1.model,
    __metadata("design:paramtypes", [String])
], CoreTestFunctionDeclaration);
exports.CoreTestFunctionDeclaration = CoreTestFunctionDeclaration;
let CoreTestVariableRefExpression = class CoreTestVariableRefExpression extends CoreTestExpression_1.CoreTestExpression {
    constructor() {
        super();
        this.$typename = "CoreTestVariableRefExpression";
        this.getName = this.getName.bind(this);
    }
    get refVariable() {
        return this.model.functions[0].parameters.find(v => v.name === this.referredName);
    }
    get refAttribute() {
        const refVar = this.refVariable;
        return refVar ? refVar.type.attributes.find(a => a.name === this.attribute) : null;
    }
    getName() {
        return this.referredName;
    }
    toString() {
        return "$" + this.referredName;
    }
    children() {
        return [];
    }
};
__decorate([
    language_1.observablereference,
    __metadata("design:type", CoreTestVariable_1.CoreTestVariable),
    __metadata("design:paramtypes", [])
], CoreTestVariableRefExpression.prototype, "refVariable", null);
__decorate([
    language_1.observablereference,
    __metadata("design:type", CoreTestAttribute_1.CoreTestAttribute),
    __metadata("design:paramtypes", [])
], CoreTestVariableRefExpression.prototype, "refAttribute", null);
CoreTestVariableRefExpression = __decorate([
    language_1.model,
    __metadata("design:paramtypes", [])
], CoreTestVariableRefExpression);
exports.CoreTestVariableRefExpression = CoreTestVariableRefExpression;
//# sourceMappingURL=CoreTestVariableRef.js.map