Skip to content

Commit

Permalink
Unwrap sequence await callee in analyzer (vercel/turborepo#3623)
Browse files Browse the repository at this point in the history
Close WEB-555
  • Loading branch information
Brooooooklyn authored Feb 6, 2023
1 parent d86436c commit e7c3a26
Show file tree
Hide file tree
Showing 14 changed files with 3,288 additions and 3 deletions.
2 changes: 2 additions & 0 deletions crates/turbopack-ecmascript/src/analyzer/graph.rs
Original file line number Diff line number Diff line change
Expand Up @@ -449,6 +449,8 @@ impl EvalContext {
SyntaxContext::empty(),
)),

Expr::Await(AwaitExpr { arg, .. }) => self.eval(arg),

Expr::New(..) => JsValue::Unknown(None, "unknown new expression"),

Expr::Seq(e) => {
Expand Down
6 changes: 3 additions & 3 deletions crates/turbopack-ecmascript/src/analyzer/well_known.rs
Original file line number Diff line number Diff line change
Expand Up @@ -391,9 +391,9 @@ pub async fn well_known_object_member(
WellKnownObjectKind::PathModule | WellKnownObjectKind::PathModuleDefault => {
path_module_member(kind, prop)
}
WellKnownObjectKind::FsModule | WellKnownObjectKind::FsModuleDefault => {
fs_module_member(kind, prop)
}
WellKnownObjectKind::FsModule
| WellKnownObjectKind::FsModuleDefault
| WellKnownObjectKind::FsModulePromises => fs_module_member(kind, prop),
WellKnownObjectKind::UrlModule | WellKnownObjectKind::UrlModuleDefault => {
url_module_member(kind, prop)
}
Expand Down
3 changes: 3 additions & 0 deletions crates/turbopack-ecmascript/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ pub fn unparen(expr: &Expr) -> &Expr {
if let Some(expr) = expr.as_paren() {
return unparen(&expr.expr);
}
if let Expr::Seq(seq) = expr {
return unparen(seq.exprs.last().unwrap());
}
expr
}

Expand Down
Loading

0 comments on commit e7c3a26

Please sign in to comment.