import syntax with import declaration
Constellation opened this issue · comments
When we have the following script in the module context,
// The goal symbol is Module.
import("./x.js"); // Top level!
When we see import
keywrod, we encounter ambiguity between import declaration and import call.
Is this understanding correct?
I think we need [lookahead != (]
for import declarations.
I'm not very good at this grammar stuff myself, so I hope we can get some experts to weigh in. My gut feeling is that this would have been caught during the stage 3 reviews and so probably the spec is OK as-is? And here is one thought as to why that might be the case. The given string does not seem to match ImportDeclaration at all. But I am not really sure when we use lookahead restrictions on top of basic stuff like grammar not matching. I'll ask around.
Given that import
declarations cannot have a (
following import
I don't see a need for lookahead: if you see a (
, then you know you're parsing an expression, not a declaration.
Closing as it seems this is OK :)
Yeah, I've confirmed it is OK. Thanks!