@@ -2,12 +2,12 @@ use crate::parsing::{Input, NodeFnAttributes, ParsedField, ParsedFieldType, Pars
2
2
use crate :: shader_nodes:: { ShaderCodegen , ShaderNodeType , ShaderTokens } ;
3
3
use convert_case:: { Case , Casing } ;
4
4
use proc_macro_crate:: FoundCrate ;
5
- use proc_macro2:: { Ident , Span , TokenStream } ;
5
+ use proc_macro2:: { Ident , TokenStream } ;
6
6
use quote:: { ToTokens , format_ident, quote} ;
7
7
use std:: borrow:: Cow ;
8
8
use syn:: parse:: { Parse , ParseStream } ;
9
9
use syn:: punctuated:: Punctuated ;
10
- use syn:: { Token , TraitBound , TraitBoundModifier , Type , TypeImplTrait , TypeParamBound } ;
10
+ use syn:: { Type , parse_quote } ;
11
11
12
12
#[ derive( Debug , Clone ) ]
13
13
pub struct PerPixelAdjust { }
@@ -119,7 +119,7 @@ impl PerPixelAdjust {
119
119
FoundCrate :: Itself => format_ident ! ( "crate" ) ,
120
120
FoundCrate :: Name ( name) => format_ident ! ( "{name}" ) ,
121
121
} ;
122
- let raster_gpu = syn :: parse2 :: < Type > ( quote ! ( #gcore:: table:: Table <#gcore:: raster_types:: Raster <#gcore:: raster_types:: GPU >>) ) ? ;
122
+ let raster_gpu: Type = parse_quote ! ( #gcore:: table:: Table <#gcore:: raster_types:: Raster <#gcore:: raster_types:: GPU >>) ;
123
123
124
124
let fields = parsed
125
125
. fields
@@ -128,6 +128,7 @@ impl PerPixelAdjust {
128
128
ParsedFieldType :: Regular ( reg @ RegularParsedField { gpu_image : true , .. } ) => Ok ( ParsedField {
129
129
ty : ParsedFieldType :: Regular ( RegularParsedField {
130
130
ty : raster_gpu. clone ( ) ,
131
+ implementations : Punctuated :: default ( ) ,
131
132
..reg. clone ( )
132
133
} ) ,
133
134
..f. clone ( )
@@ -143,7 +144,7 @@ impl PerPixelAdjust {
143
144
}
144
145
} ;
145
146
146
- let gpu_node = crate :: codegen :: generate_node_code ( & ParsedNodeFn {
147
+ let mut parsed_node_fn = ParsedNodeFn {
147
148
vis : parsed. vis . clone ( ) ,
148
149
attributes : NodeFnAttributes {
149
150
shader_node : Some ( ShaderNodeType :: GpuNode ) ,
@@ -156,15 +157,7 @@ impl PerPixelAdjust {
156
157
where_clause : None ,
157
158
input : Input {
158
159
pat_ident : parsed. input . pat_ident . clone ( ) ,
159
- ty : Type :: ImplTrait ( TypeImplTrait {
160
- impl_token : Token ! [ impl ] ( Span :: call_site ( ) ) ,
161
- bounds : Punctuated :: from_iter ( [ TypeParamBound :: Trait ( TraitBound {
162
- paren_token : None ,
163
- modifier : TraitBoundModifier :: None ,
164
- lifetimes : None ,
165
- path : syn:: parse2 ( quote ! ( #gcore:: context:: Ctx ) ) ?,
166
- } ) ] ) ,
167
- } ) ,
160
+ ty : parse_quote ! ( impl #gcore:: context:: Ctx ) ,
168
161
implementations : Default :: default ( ) ,
169
162
} ,
170
163
output_type : raster_gpu,
@@ -173,7 +166,9 @@ impl PerPixelAdjust {
173
166
body,
174
167
crate_name : parsed. crate_name . clone ( ) ,
175
168
description : "" . to_string ( ) ,
176
- } ) ?;
169
+ } ;
170
+ parsed_node_fn. replace_impl_trait_in_input ( ) ;
171
+ let gpu_node = crate :: codegen:: generate_node_code ( & parsed_node_fn) ?;
177
172
178
173
Ok ( quote ! {
179
174
#node_cfg
0 commit comments