File tree Expand file tree Collapse file tree 2 files changed +20
-2
lines changed Expand file tree Collapse file tree 2 files changed +20
-2
lines changed Original file line number Diff line number Diff line change @@ -181,11 +181,13 @@ function ident(node) {
181
181
}
182
182
183
183
function memExp ( node ) {
184
- const { object, property } = node ;
184
+ const { object, property, computed } = node ;
185
185
if ( property . type === 'Literal' || property . type === 'CallExpression' ) {
186
186
return `${ handleNode ( object ) } [${ handleNode ( property ) } ]` ;
187
187
}
188
- // console.log('memExp', object.name, node);
188
+ if ( computed ) {
189
+ return `${ handleNode ( object ) } [${ handleNode ( property ) } ]` ;
190
+ }
189
191
return `${ handleNode ( object ) } .${ handleNode ( property ) } ` ;
190
192
}
191
193
Original file line number Diff line number Diff line change @@ -190,6 +190,22 @@ MyType bar;
190
190
assert . equal ( glsl . trim ( ) , expected . trim ( ) ) ;
191
191
} ) ;
192
192
193
+ it ( 'works with mat access arrays' , ( ) => {
194
+ const { glsl } = buildGLSL ( ( ) => {
195
+ let foo = mat4 ( 1.0 ) ;
196
+ let x = int ( 3 ) ;
197
+ let bar = float ( foo [ x ] [ 1 ] ) ;
198
+ } ) ;
199
+
200
+ const expected = `
201
+ mat4 foo = mat4(1.0);
202
+ int x = int(3);
203
+ float bar = float(foo[x][1]);
204
+ ` ;
205
+
206
+ assert . equal ( glsl . trim ( ) , expected . trim ( ) ) ;
207
+ } ) ;
208
+
193
209
it ( 'works with float arrays' , ( ) => {
194
210
const { glsl } = buildGLSL ( ( ) => {
195
211
let foo = float ( [ 1.0 , 2.0 ] ) ;
You can’t perform that action at this time.
0 commit comments