Skip to content

Commit e4e0fd4

Browse files
committed
Revert "do basic check for valid subscript syntax"
This reverts commit 24be49c.
1 parent 2f94c60 commit e4e0fd4

File tree

1 file changed

+0
-22
lines changed

1 file changed

+0
-22
lines changed

src/processScript/preprocess.ts

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,13 @@ import t from "@babel/types"
77
import type { LaxPartial } from "@samual/lib"
88
import { assert } from "@samual/lib/assert"
99
import { spliceString } from "@samual/lib/spliceString"
10-
import { tokenizer as tokenise, tokTypes as TokenTypes } from "acorn"
1110
import { resolve as resolveModule } from "import-meta-resolve"
1211

1312
// eslint-disable-next-line @typescript-eslint/consistent-type-imports
1413
const { default: traverse } = babelTraverse as any as typeof import("@babel/traverse")
1514
// eslint-disable-next-line @typescript-eslint/consistent-type-imports
1615
const { default: generate } = babelGenerator as any as typeof import("@babel/generator")
1716

18-
const SUBSCRIPT_PREFIXES = [ `s`, `fs`, `4s`, `hs`, `3s`, `ms`, `2s`, `ls`, `1s`, `ns`, `0s` ]
19-
2017
export type PreprocessOptions = LaxPartial<{ /** 11 a-z 0-9 characters */ uniqueId: string }>
2118

2219
/** @param code source code for preprocessing
@@ -25,25 +22,6 @@ export async function preprocess(code: string, { uniqueId = `00000000000` }: Pre
2522
: Promise<{ code: string }> {
2623
assert(/^\w{11}$/.test(uniqueId), HERE)
2724

28-
const tokensIterable = tokenise(code, { ecmaVersion: `latest` })
29-
30-
for (const token of tokensIterable) {
31-
assert(`value` in token, HERE)
32-
33-
if (token.type != TokenTypes.privateId)
34-
continue
35-
36-
assert(typeof token.value == `string`, HERE)
37-
38-
if (!SUBSCRIPT_PREFIXES.includes(token.value))
39-
continue
40-
41-
const nextToken = tokensIterable.getToken()
42-
43-
if (nextToken.type != TokenTypes._in && nextToken.type != TokenTypes.dot)
44-
throw SyntaxError(`Subscripts must be in the form of #fs.foo.bar`)
45-
}
46-
4725
const sourceCode = code
4826
let lengthBefore
4927

0 commit comments

Comments
 (0)