@@ -4902,30 +4902,31 @@ Expr* SemanticsExprVisitor::visitMemberExpr(MemberExpr* expr)
4902
4902
// to swizzle vectors interferes with any chance of looking up
4903
4903
// members via extension, for vector or scalar types.
4904
4904
//
4905
- if (auto baseMatrixType = as<MatrixExpressionType >(baseType))
4905
+ if (auto baseScalarType = as<BasicExpressionType >(baseType))
4906
4906
{
4907
- auto swizzle = CheckMatrixSwizzleExpr (
4908
- expr,
4909
- baseMatrixType->getElementType (),
4910
- baseMatrixType->getRowCount (),
4911
- baseMatrixType->getColumnCount ());
4907
+ // Treat scalar like a 1-element vector when swizzling
4908
+ auto swizzle = CheckSwizzleExpr (expr, baseScalarType, 1 );
4912
4909
if (swizzle)
4913
4910
return swizzle;
4914
4911
}
4915
- if (auto baseVecType = as<VectorExpressionType>(baseType))
4912
+ else if (auto baseVecType = as<VectorExpressionType>(baseType))
4916
4913
{
4917
4914
auto swizzle =
4918
4915
CheckSwizzleExpr (expr, baseVecType->getElementType (), baseVecType->getElementCount ());
4919
4916
if (swizzle)
4920
4917
return swizzle;
4921
4918
}
4922
- if (auto baseScalarType = as<BasicExpressionType >(baseType))
4919
+ else if (auto baseMatrixType = as<MatrixExpressionType >(baseType))
4923
4920
{
4924
- // Treat scalar like a 1-element vector when swizzling
4925
- auto swizzle = CheckSwizzleExpr (expr, baseScalarType, 1 );
4921
+ auto swizzle = CheckMatrixSwizzleExpr (
4922
+ expr,
4923
+ baseMatrixType->getElementType (),
4924
+ baseMatrixType->getRowCount (),
4925
+ baseMatrixType->getColumnCount ());
4926
4926
if (swizzle)
4927
4927
return swizzle;
4928
4928
}
4929
+
4929
4930
if (as<NamespaceType>(baseType))
4930
4931
{
4931
4932
return _lookupStaticMember (expr, expr->baseExpression );
0 commit comments