make sure the new identifiers have end-locations

This commit is contained in:
erik-krogh
2024-08-07 10:25:22 +02:00
parent b8187ed294
commit bef4fe627d
3 changed files with 146 additions and 2 deletions

View File

@@ -3555,7 +3555,7 @@ public class Parser {
// e.g. `export { Foo_new as "Foo::new" }`
Expression string = this.parseExprAtom(null);
String str = ((Literal)string).getStringValue();
exported = new Identifier(loc, str);
exported = this.finishNode(new Identifier(loc, str));
} else {
exported = this.parseIdent(true);
}
@@ -3648,7 +3648,7 @@ public class Parser {
// e.g. `import { "Foo::new" as Foo_new } from "./foo.wasm"`
Expression string = this.parseExprAtom(null);
String str = ((Literal)string).getStringValue();
imported = new Identifier(loc, str);
imported = this.finishNode(new Identifier(loc, str));
// only makes sense if there is a local identifier
if (!this.isContextual("as")) {
this.raiseRecoverable(this.start, "Unexpected string");