|
Last change
on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 2 weeks ago |
|
Fix frontend appearance
|
-
Property mode
set to
100644
|
|
File size:
599 bytes
|
| Line | |
|---|
| 1 | import {ContextualKeyword} from "../parser/tokenizer/keywords";
|
|---|
| 2 | import {TokenType as tt} from "../parser/tokenizer/types";
|
|---|
| 3 |
|
|---|
| 4 |
|
|---|
| 5 | /**
|
|---|
| 6 | * Starting at a potential `with` or (legacy) `assert` token, remove the import
|
|---|
| 7 | * attributes if they exist.
|
|---|
| 8 | */
|
|---|
| 9 | export function removeMaybeImportAttributes(tokens) {
|
|---|
| 10 | if (
|
|---|
| 11 | tokens.matches2(tt._with, tt.braceL) ||
|
|---|
| 12 | (tokens.matches2(tt.name, tt.braceL) && tokens.matchesContextual(ContextualKeyword._assert))
|
|---|
| 13 | ) {
|
|---|
| 14 | // assert
|
|---|
| 15 | tokens.removeToken();
|
|---|
| 16 | // {
|
|---|
| 17 | tokens.removeToken();
|
|---|
| 18 | tokens.removeBalancedCode();
|
|---|
| 19 | // }
|
|---|
| 20 | tokens.removeToken();
|
|---|
| 21 | }
|
|---|
| 22 | }
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.