mirror of
https://github.com/oxc-project/oxc.git
synced 2026-11-04 10:29:58 +00:00
feat(ecmascript): ValueType::from for parenthesized expressions (#8962)
This commit is contained in:
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}");
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user