google/closure-compiler

Parse error for quoted export/import names

Open

#3.961 geöffnet am 20. Juni 2022

Auf GitHub ansehen
 (1 Kommentar) (0 Reaktionen) (0 zugewiesene Personen)Java (7.176 Stars) (1.197 Forks)batch import
P3help wanted

Beschreibung

// e.mjs
const a = 'print me';
export { a as "dove" };
// i.mjs
import { "dove" as b } from './e.mjs';
console.log(b);

"dove" is the quoted name, and this code works (i.mjs prints print me).

Spec reference: ModuleExportName can be StringLiteral.

However, compiler can't parse that:

e.mjs:3:14: ERROR - [JSC_PARSE_ERROR] Parse error. 'identifier' expected
  3| export { a as "dove" };
                   ^
i.mjs:2:9: ERROR - [JSC_PARSE_ERROR] Parse error. '}' expected
  2| import { "dove" as b } from './e.mjs';
              ^

Contributor Guide