Skip to content

Commit a0dc4ac

Browse files
committed
Fix.
1 parent cf51e9a commit a0dc4ac

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

source/slang/slang-check-expr.cpp

+11-10
Original file line numberDiff line numberDiff line change
@@ -4902,30 +4902,31 @@ Expr* SemanticsExprVisitor::visitMemberExpr(MemberExpr* expr)
49024902
// to swizzle vectors interferes with any chance of looking up
49034903
// members via extension, for vector or scalar types.
49044904
//
4905-
if (auto baseMatrixType = as<MatrixExpressionType>(baseType))
4905+
if (auto baseScalarType = as<BasicExpressionType>(baseType))
49064906
{
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);
49124909
if (swizzle)
49134910
return swizzle;
49144911
}
4915-
if (auto baseVecType = as<VectorExpressionType>(baseType))
4912+
else if (auto baseVecType = as<VectorExpressionType>(baseType))
49164913
{
49174914
auto swizzle =
49184915
CheckSwizzleExpr(expr, baseVecType->getElementType(), baseVecType->getElementCount());
49194916
if (swizzle)
49204917
return swizzle;
49214918
}
4922-
if (auto baseScalarType = as<BasicExpressionType>(baseType))
4919+
else if (auto baseMatrixType = as<MatrixExpressionType>(baseType))
49234920
{
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());
49264926
if (swizzle)
49274927
return swizzle;
49284928
}
4929+
49294930
if (as<NamespaceType>(baseType))
49304931
{
49314932
return _lookupStaticMember(expr, expr->baseExpression);

0 commit comments

Comments
 (0)