Fixed regression that caused a crash in the presence of the illegal statement import .. This addresses https://github.com/microsoft/pyright/issues/4778.

This commit is contained in:
Eric Traut 2023-03-16 15:25:41 -06:00
parent 425908eced
commit 0997c33577

View File

@ -2531,11 +2531,11 @@ export class Parser {
const nameParts = importAsNode.module.nameParts.map((p) => p.value);
if (importAsNode.alias) {
if (importAsNode.alias || importAsNode.module.leadingDots > 0) {
this._importedModules.push({
nameNode: importAsNode.module,
leadingDots: importAsNode.module.leadingDots,
nameParts: nameParts,
nameParts,
importedSymbols: undefined,
});
} else {