UNPKG
@philpl/buble
Version:
latest (0.19.7)
0.19.7
The blazing fast, batteries-included ES2015 compiler
github.com/bublejs/buble
bublejs/buble
@philpl/buble
/
src
/
utils
/
checkConst.js
9 lines
(7 loc)
•
294 B
JavaScript
View Raw
1
2
3
4
5
6
7
8
9
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); } }