UNPKG

js-slang

Version:

Javascript-based implementations of Source, written in Typescript

29 lines 1.31 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.NoExportNamedDeclarationWithDefaultError = void 0; const localImport_prelude_1 = require("../../../stdlib/localImport.prelude"); const syntax_1 = require("../syntax"); const errors_1 = require("../../errors"); const misc_1 = require("../../../utils/misc"); class NoExportNamedDeclarationWithDefaultError extends errors_1.RuleError { explain() { return 'Export default declarations are not allowed.'; } elaborate() { return 'You are trying to use an export default declaration, which is not allowed (yet).'; } } exports.NoExportNamedDeclarationWithDefaultError = NoExportNamedDeclarationWithDefaultError; const noExportNamedDeclarationWithDefault = { name: 'no-declare-mutable', disableFromChapter: syntax_1.default['ExportDefaultDeclaration'], checkers: { ExportNamedDeclaration(node) { return (0, misc_1.mapAndFilter)(node.specifiers, specifier => specifier.exported.name === localImport_prelude_1.defaultExportLookupName ? new NoExportNamedDeclarationWithDefaultError(node) : undefined); } } }; exports.default = noExportNamedDeclarationWithDefault; //# sourceMappingURL=noExportNamedDeclarationWithDefault.js.map