1 | "use strict";
|
---|
2 |
|
---|
3 | Object.defineProperty(exports, "__esModule", {
|
---|
4 | value: true
|
---|
5 | });
|
---|
6 | exports.isReservedWord = isReservedWord;
|
---|
7 | exports.isStrictReservedWord = isStrictReservedWord;
|
---|
8 | exports.isStrictBindOnlyReservedWord = isStrictBindOnlyReservedWord;
|
---|
9 | exports.isStrictBindReservedWord = isStrictBindReservedWord;
|
---|
10 | exports.isKeyword = isKeyword;
|
---|
11 | const reservedWords = {
|
---|
12 | keyword: ["break", "case", "catch", "continue", "debugger", "default", "do", "else", "finally", "for", "function", "if", "return", "switch", "throw", "try", "var", "const", "while", "with", "new", "this", "super", "class", "extends", "export", "import", "null", "true", "false", "in", "instanceof", "typeof", "void", "delete"],
|
---|
13 | strict: ["implements", "interface", "let", "package", "private", "protected", "public", "static", "yield"],
|
---|
14 | strictBind: ["eval", "arguments"]
|
---|
15 | };
|
---|
16 | const keywords = new Set(reservedWords.keyword);
|
---|
17 | const reservedWordsStrictSet = new Set(reservedWords.strict);
|
---|
18 | const reservedWordsStrictBindSet = new Set(reservedWords.strictBind);
|
---|
19 |
|
---|
20 | function isReservedWord(word, inModule) {
|
---|
21 | return inModule && word === "await" || word === "enum";
|
---|
22 | }
|
---|
23 |
|
---|
24 | function isStrictReservedWord(word, inModule) {
|
---|
25 | return isReservedWord(word, inModule) || reservedWordsStrictSet.has(word);
|
---|
26 | }
|
---|
27 |
|
---|
28 | function isStrictBindOnlyReservedWord(word) {
|
---|
29 | return reservedWordsStrictBindSet.has(word);
|
---|
30 | }
|
---|
31 |
|
---|
32 | function isStrictBindReservedWord(word, inModule) {
|
---|
33 | return isStrictReservedWord(word, inModule) || isStrictBindOnlyReservedWord(word);
|
---|
34 | }
|
---|
35 |
|
---|
36 | function isKeyword(word) {
|
---|
37 | return keywords.has(word);
|
---|
38 | } |
---|