js-slang
Version:
Javascript-based implementations of Source, written in Typescript
31 lines • 1 kB
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
exports.NoDotAbbreviationError = void 0;
const errors_1 = require("../../errors");
const types_1 = require("../../../types");
class NoDotAbbreviationError extends errors_1.RuleError {
explain() {
return 'Dot abbreviations are not allowed.';
}
elaborate() {
return `Source doesn't use object-oriented programming, so you don't need any dots in your code (except decimal \
points in numbers).`;
}
}
exports.NoDotAbbreviationError = NoDotAbbreviationError;
const noDotAbbreviation = {
name: 'no-dot-abbreviation',
disableFromChapter: types_1.Chapter.LIBRARY_PARSER,
checkers: {
MemberExpression(node) {
if (!node.computed) {
return [new NoDotAbbreviationError(node)];
}
else {
return [];
}
}
}
};
exports.default = noDotAbbreviation;
//# sourceMappingURL=noDotAbbreviation.js.map
;