feat(ecmascript): ValueType::from for parenthesized expressions (#8962)

This commit is contained in:
sapphi-red committed 2025-02-07 23:57:09 +00:00
1 parent 2c3a46d0aa
commit c3eef2fc35
2 files changed
+2 -1

No files matched your search

@@ -111,6 +111,7 @@ impl<'a> From<&Expression<'a>> for ValueType {
Expression::AssignmentExpression(e) => Self::from(&**e),
Expression::ConditionalExpression(e) => Self::from(&**e),
Expression::LogicalExpression(e) => Self::from(&**e),
Expression::ParenthesizedExpression(e) => Self::from(&e.expression),
_ => Self::Undetermined,
}
}
@@ -13,7 +13,7 @@ fn test(source_text: &str, expected: ValueType) {
let Some(Statement::ExpressionStatement(stmt)) = &ret.program.body.first() else {
panic!("should have a expression statement body: {source_text}");
};
let result = ValueType::from(stmt.expression.without_parentheses());
let result = ValueType::from(&stmt.expression);
assert_eq!(result, expected, "{source_text}");
}