Allow multiple exports.

This commit is contained in:
Stephen Chung
2020-11-09 14:38:33 +08:00
parent 173f8474d6
commit 821e64adc4
8 changed files with 43 additions and 38 deletions

View File

@@ -2076,19 +2076,6 @@ fn parse_export(
}
}
// Check for duplicating parameters
exports
.iter()
.enumerate()
.try_for_each(|(i, (Ident { name: id1, .. }, _))| {
exports
.iter()
.skip(i + 1)
.find(|(Ident { name: id2, .. }, _)| id2 == id1)
.map_or_else(|| Ok(()), |(Ident { name: id2, pos }, _)| Err((id2, *pos)))
})
.map_err(|(id2, pos)| PERR::DuplicatedExport(id2.to_string()).into_err(pos))?;
Ok(Stmt::Export(exports, token_pos))
}