@@ -140,6 +140,66 @@ pub enum ExpressionError {
140140 UnsupportedWidth ( crate :: MathFunction , crate :: ScalarKind , crate :: Bytes ) ,
141141}
142142
143+ impl ExpressionError {
144+ pub ( crate ) fn expr_handles ( & self ) -> impl Iterator < Item = ( Handle < crate :: Expression > , String ) > {
145+ match * self {
146+ Self :: NotInScope => Vec :: new ( ) ,
147+ Self :: InvalidBaseType ( ..) => Vec :: new ( ) ,
148+ Self :: InvalidIndexType ( ..) => Vec :: new ( ) ,
149+ Self :: NegativeIndex ( ..) => Vec :: new ( ) ,
150+ Self :: IndexOutOfBounds ( ..) => Vec :: new ( ) ,
151+ Self :: FunctionArgumentDoesntExist ( ..) => Vec :: new ( ) ,
152+ Self :: InvalidPointerType ( ..) => Vec :: new ( ) ,
153+ Self :: InvalidArrayType ( ..) => Vec :: new ( ) ,
154+ Self :: InvalidRayQueryType ( ..) => Vec :: new ( ) ,
155+ Self :: InvalidSplatType ( ..) => Vec :: new ( ) ,
156+ Self :: InvalidVectorType ( ..) => Vec :: new ( ) ,
157+ Self :: InvalidSwizzleComponent ( ..) => Vec :: new ( ) ,
158+ Self :: Compose ( ..) => Vec :: new ( ) ,
159+ Self :: IndexableLength ( ..) => Vec :: new ( ) ,
160+ Self :: InvalidUnaryOperandType ( ..) => Vec :: new ( ) ,
161+ Self :: InvalidBinaryOperandTypes { .. } => Vec :: new ( ) ,
162+ Self :: SelectValuesTypeMismatch { .. } => Vec :: new ( ) ,
163+ Self :: SelectConditionNotABool { .. } => Vec :: new ( ) ,
164+ Self :: InvalidBooleanVector ( ..) => Vec :: new ( ) ,
165+ Self :: InvalidFloatArgument ( ..) => Vec :: new ( ) ,
166+ Self :: Type ( ..) => Vec :: new ( ) ,
167+ Self :: ExpectedGlobalVariable => Vec :: new ( ) ,
168+ Self :: ExpectedGlobalOrArgument => Vec :: new ( ) ,
169+ Self :: ExpectedBindingArrayType ( ..) => Vec :: new ( ) ,
170+ Self :: ExpectedImageType ( ..) => Vec :: new ( ) ,
171+ Self :: ExpectedSamplerType ( ..) => Vec :: new ( ) ,
172+ Self :: InvalidImageClass ( ..) => Vec :: new ( ) ,
173+ Self :: InvalidDerivative => Vec :: new ( ) ,
174+ Self :: InvalidImageArrayIndex => Vec :: new ( ) ,
175+ Self :: InvalidImageOtherIndex => Vec :: new ( ) ,
176+ Self :: InvalidImageArrayIndexType ( ..) => Vec :: new ( ) ,
177+ Self :: InvalidImageOtherIndexType ( ..) => Vec :: new ( ) ,
178+ Self :: InvalidImageCoordinateType ( ..) => Vec :: new ( ) ,
179+ Self :: ComparisonSamplingMismatch { .. } => Vec :: new ( ) ,
180+ Self :: InvalidSampleOffsetExprType => Vec :: new ( ) ,
181+ Self :: InvalidSampleOffset ( ..) => Vec :: new ( ) ,
182+ Self :: InvalidDepthReference ( ..) => Vec :: new ( ) ,
183+ Self :: InvalidDepthSampleLevel => Vec :: new ( ) ,
184+ Self :: InvalidGatherLevel => Vec :: new ( ) ,
185+ Self :: InvalidGatherComponent ( ..) => Vec :: new ( ) ,
186+ Self :: InvalidGatherDimension ( ..) => Vec :: new ( ) ,
187+ Self :: InvalidSampleLevelExactType ( ..) => Vec :: new ( ) ,
188+ Self :: InvalidSampleLevelBiasType ( ..) => Vec :: new ( ) ,
189+ Self :: InvalidSampleLevelBiasDimension ( ..) => Vec :: new ( ) ,
190+ Self :: InvalidSampleLevelGradientType ( ..) => Vec :: new ( ) ,
191+ Self :: InvalidCastArgument => Vec :: new ( ) ,
192+ Self :: WrongArgumentCount ( ..) => Vec :: new ( ) ,
193+ Self :: InvalidArgumentType ( ..) => Vec :: new ( ) ,
194+ Self :: InvalidWorkGroupUniformLoadResultType ( ..) => Vec :: new ( ) ,
195+ Self :: MissingCapabilities ( ..) => Vec :: new ( ) ,
196+ Self :: Literal ( ..) => Vec :: new ( ) ,
197+ Self :: UnsupportedWidth ( ..) => Vec :: new ( ) ,
198+ }
199+ . into_iter ( )
200+ }
201+ }
202+
143203#[ derive( Clone , Debug , thiserror:: Error ) ]
144204#[ cfg_attr( test, derive( PartialEq ) ) ]
145205pub enum ConstExpressionError {
0 commit comments