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