File tree Expand file tree Collapse file tree 2 files changed +5
-5
lines changed Expand file tree Collapse file tree 2 files changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -290,7 +290,7 @@ function handleAssign(node) {
290
290
typeAnnotation = init . returnType ;
291
291
allocation = handleNode ( init ) ;
292
292
} else {
293
- allocation = handleAlloc ( init , typeAnnotation ) ;
293
+ allocation = handleAlloc ( init , typeAnnotation , name ) ;
294
294
}
295
295
}
296
296
@@ -301,7 +301,7 @@ function handleAssign(node) {
301
301
return `${ qualifier } ${ typeAnnotation } ${ name } ${ allocation } ` ;
302
302
}
303
303
304
- function handleAlloc ( init , typeAnnotation ) {
304
+ function handleAlloc ( init , typeAnnotation , name ) {
305
305
let allocation = '' ;
306
306
if ( init . type === 'CallExpression' ) {
307
307
@@ -325,7 +325,7 @@ function handleAlloc(init, typeAnnotation) {
325
325
if ( init . arguments . length === 1 ) {
326
326
const [ first ] = init . arguments ;
327
327
if ( first . type === 'ArrayExpression' ) {
328
- allocation = ` = ${ typeAnnotation } ( ${ first . elements . map ( handleNode ) . join ( ', ' ) } ) ` ;
328
+ allocation = `; ${ first . elements . map ( ( n , i ) => ` ${ name } [ ${ i } ] = ${ handleNode ( n ) } ` ) . join ( '; ' ) } ; ` ;
329
329
} else {
330
330
allocation = ` = ${ handleNode ( init . arguments [ 0 ] ) } ` ;
331
331
}
Original file line number Diff line number Diff line change @@ -196,7 +196,7 @@ MyType bar;
196
196
} ) ;
197
197
198
198
const expected = `
199
- float[2] foo = float[2]( 1.0, 2.0) ;
199
+ float[2] foo; foo[0] = 1.0; foo[1] = 2.0;
200
200
` ;
201
201
202
202
assert . equal ( glsl . trim ( ) , expected . trim ( ) ) ;
@@ -208,7 +208,7 @@ float[2] foo = float[2](1.0, 2.0);
208
208
} ) ;
209
209
210
210
const expected = `
211
- vec2[2] foo = vec2[2](vec2( 1.0, 2.0), vec(3.0, 4.0) );
211
+ vec2[2] foo; foo[0] = vec2( 1.0, 2.0); foo[1] = vec(3.0, 4.0);
212
212
` ;
213
213
214
214
assert . equal ( glsl . trim ( ) , expected . trim ( ) ) ;
You can’t perform that action at this time.
0 commit comments