1 |
|
2 | import {TokenType as tt} from "../parser/tokenizer/types";
|
3 |
|
4 | /**
|
5 | * Get all identifier names in the code, in order, including duplicates.
|
6 | */
|
7 | export default function getIdentifierNames(code, tokens) {
|
8 | const names = [];
|
9 | for (const token of tokens) {
|
10 | if (token.type === tt.name) {
|
11 | names.push(code.slice(token.start, token.end));
|
12 | }
|
13 | }
|
14 | return names;
|
15 | }
|