ts-budgie
Version:
Converts TypeScript code to Budgie.
46 lines • 2.11 kB
JavaScript
;
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
var budgie_1 = require("budgie");
var budgieLine_1 = require("../../output/budgieLine");
var numerics_1 = require("../numerics");
var recursiveAliaser_1 = require("./recursiveAliaser");
var ElementAccessExpressionAliaser = /** @class */ (function (_super) {
__extends(ElementAccessExpressionAliaser, _super);
function ElementAccessExpressionAliaser() {
return _super !== null && _super.apply(this, arguments) || this;
}
ElementAccessExpressionAliaser.prototype.getFriendlyTypeName = function (node) {
var argumentExpression = node.argumentExpression;
if (argumentExpression === undefined) {
return undefined;
}
var argumentType = this.recurseOntoNode(argumentExpression);
if (typeof argumentType !== "string" || !numerics_1.isNumericTypeName(argumentType)) {
return undefined;
}
var arrayType = this.recurseOntoNode(node.expression);
if (!(arrayType instanceof budgieLine_1.BudgieLine)) {
return undefined;
}
if (arrayType.command === budgie_1.CommandNames.ListType) {
return arrayType.args[0];
}
return undefined;
};
return ElementAccessExpressionAliaser;
}(recursiveAliaser_1.RecursiveAliaser));
exports.ElementAccessExpressionAliaser = ElementAccessExpressionAliaser;
//# sourceMappingURL=elementAccessExpressionAliaser.js.map