UNPKG

@philpl/buble

Version:

The blazing fast, batteries-included ES2015 compiler

9 lines (7 loc) 294 B
import CompileError from './CompileError.js'; export default function checkConst(identifier, scope) { const declaration = scope.findDeclaration(identifier.name); if (declaration && declaration.kind === 'const') { throw new CompileError(`${identifier.name} is read-only`, identifier); } }