mirror of
https://github.com/github/codeql.git
synced 2026-04-21 23:14:03 +02:00
support arbitary export specifiers
This commit is contained in:
@@ -3547,7 +3547,19 @@ public class Parser {
|
||||
|
||||
SourceLocation loc = new SourceLocation(this.startLoc);
|
||||
Identifier local = this.parseIdent(this.type == TokenType._default);
|
||||
Identifier exported = this.eatContextual("as") ? this.parseIdent(true) : local;
|
||||
Identifier exported;
|
||||
if (!this.eatContextual("as")) {
|
||||
exported = local;
|
||||
} else {
|
||||
if (this.type == TokenType.string) {
|
||||
// e.g. `export { Foo_new as "Foo::new" }`
|
||||
Expression string = this.parseExprAtom(null);
|
||||
String str = ((Literal)string).getStringValue();
|
||||
exported = new Identifier(loc, str);
|
||||
} else {
|
||||
exported = this.parseIdent(true);
|
||||
}
|
||||
}
|
||||
checkExport(exports, exported.getName(), exported.getLoc().getStart());
|
||||
nodes.add(this.finishNode(new ExportSpecifier(loc, local, exported)));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user