@@ -145,14 +145,20 @@ func (t *transformer) transformNodes(nodes []ast.Node) []ast.Node {
145
145
return
146
146
}
147
147
148
- newDecls := make ([]* ast.Declaration , 0 , len (declBlock .Declarations ))
148
+ newDecls := make ([]ast.Declarationish , 0 , len (declBlock .Declarations ))
149
149
for _ , decl := range declBlock .Declarations {
150
- if strings .HasPrefix (decl .Property , "--" ) && t .variables != nil {
151
- t .variables [decl .Property ] = decl .Values
152
- continue
150
+ switch d := decl .(type ) {
151
+ case * ast.Declaration :
152
+
153
+ if strings .HasPrefix (d .Property , "--" ) && t .variables != nil {
154
+ t .variables [d .Property ] = d .Values
155
+ continue
156
+ }
157
+ newDecls = append (newDecls , d )
158
+ default :
159
+ newDecls = append (newDecls , d )
153
160
}
154
161
155
- newDecls = append (newDecls , decl )
156
162
}
157
163
158
164
declBlock .Declarations = newDecls
@@ -375,11 +381,16 @@ func (t *transformer) transformBlock(block ast.Block) ast.Block {
375
381
return block
376
382
}
377
383
378
- func (t * transformer ) transformDeclarations (decls []* ast.Declaration ) []* ast.Declaration {
379
- newDecls := make ([]* ast.Declaration , 0 , len (decls ))
380
- for _ , d := range decls {
381
- d .Values = t .transformValues (d .Values )
382
- newDecls = append (newDecls , d )
384
+ func (t * transformer ) transformDeclarations (decls []ast.Declarationish ) []ast.Declarationish {
385
+ newDecls := make ([]ast.Declarationish , 0 , len (decls ))
386
+ for _ , decl := range decls {
387
+ switch d := decl .(type ) {
388
+ case * ast.Declaration :
389
+ d .Values = t .transformValues (d .Values )
390
+ newDecls = append (newDecls , d )
391
+ default :
392
+ newDecls = append (newDecls , d )
393
+ }
383
394
}
384
395
385
396
return newDecls
0 commit comments