@kipper/target-js
Version:
The JavaScript target for the Kipper compiler 🦊
88 lines • 4.38 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.JavaScriptTargetSemanticAnalyser = void 0;
const tslib_1 = require("tslib");
const core_1 = require("@kipper/core");
const target_1 = require("./target");
class JavaScriptTargetSemanticAnalyser extends core_1.KipperTargetSemanticAnalyser {
constructor() {
super(...arguments);
this.compoundStatement = undefined;
this.ifStatement = undefined;
this.switchStatement = undefined;
this.expressionStatement = undefined;
this.doWhileLoopIterationStatement = undefined;
this.whileLoopIterationStatement = undefined;
this.forLoopIterationStatement = undefined;
this.jumpStatement = undefined;
this.returnStatement = undefined;
this.parameterDeclaration = (node) => tslib_1.__awaiter(this, void 0, void 0, function* () {
this.checkViabilityOfIdentifier(node);
});
this.functionDeclaration = (node) => tslib_1.__awaiter(this, void 0, void 0, function* () {
this.checkViabilityOfIdentifier(node);
});
this.variableDeclaration = (node) => tslib_1.__awaiter(this, void 0, void 0, function* () {
this.checkViabilityOfIdentifier(node);
});
this.interfaceDeclaration = (node) => tslib_1.__awaiter(this, void 0, void 0, function* () {
this.checkViabilityOfIdentifier(node);
});
this.interfacePropertyDeclaration = (node) => tslib_1.__awaiter(this, void 0, void 0, function* () {
this.checkViabilityOfIdentifier(node);
});
this.interfaceMethodDeclaration = (node) => tslib_1.__awaiter(this, void 0, void 0, function* () {
this.checkViabilityOfIdentifier(node);
});
this.classDeclaration = (node) => tslib_1.__awaiter(this, void 0, void 0, function* () {
this.checkViabilityOfIdentifier(node);
});
this.newInstantiationExpression = undefined;
this.classConstructorDeclaration = undefined;
this.numberPrimaryExpression = undefined;
this.arrayPrimaryExpression = undefined;
this.objectPrimaryExpression = undefined;
this.objectProperty = undefined;
this.identifierPrimaryExpression = undefined;
this.memberAccessExpression = undefined;
this.identifierTypeSpecifierExpression = undefined;
this.genericTypeSpecifierExpression = undefined;
this.typeofTypeSpecifierExpression = undefined;
this.stringPrimaryExpression = undefined;
this.fStringPrimaryExpression = undefined;
this.boolPrimaryExpression = undefined;
this.tangledPrimaryExpression = undefined;
this.voidOrNullOrUndefinedPrimaryExpression = undefined;
this.incrementOrDecrementPostfixExpression = undefined;
this.functionCallExpression = undefined;
this.incrementOrDecrementUnaryExpression = undefined;
this.operatorModifiedUnaryExpression = undefined;
this.castOrConvertExpression = undefined;
this.multiplicativeExpression = undefined;
this.additiveExpression = undefined;
this.relationalExpression = undefined;
this.equalityExpression = undefined;
this.bitwiseAndExpression = undefined;
this.bitwiseOrExpression = undefined;
this.bitwiseXorExpression = undefined;
this.bitwiseShiftExpression = undefined;
this.logicalAndExpression = undefined;
this.logicalOrExpression = undefined;
this.conditionalExpression = undefined;
this.assignmentExpression = undefined;
this.lambdaPrimaryExpression = undefined;
this.typeofExpression = undefined;
this.matchesExpression = undefined;
this.instanceOfExpression = undefined;
}
checkViabilityOfIdentifier(declaration) {
const identifier = declaration.getSemanticData().identifier;
if (identifier === target_1.TargetJS.internalObjectIdentifier ||
target_1.TargetJS.reservedIdentifiers.find((i) => i === identifier)) {
this.setTracebackData({ ctx: declaration });
throw this.error(new core_1.ReservedIdentifierOverwriteError(identifier));
}
}
}
exports.JavaScriptTargetSemanticAnalyser = JavaScriptTargetSemanticAnalyser;
//# sourceMappingURL=semantic-analyser.js.map