Skip to content

Commit fcae5a2

Browse files
authoredMar 16, 2025
ArrayElementNode: Optimize indexes (#30741)
1 parent 801fd7e commit fcae5a2

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed
 

‎src/nodes/utils/ArrayElementNode.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,10 @@ class ArrayElementNode extends Node { // @TODO: If extending from TempNode it br
6363

6464
generate( builder ) {
6565

66+
const indexType = this.indexNode.getNodeType( builder );
67+
6668
const nodeSnippet = this.node.build( builder );
67-
const indexSnippet = this.indexNode.build( builder, 'uint' );
69+
const indexSnippet = this.indexNode.build( builder, indexType === 'int' ? indexType : 'uint' );
6870

6971
return `${ nodeSnippet }[ ${ indexSnippet } ]`;
7072

0 commit comments

Comments
 (0)
Failed to load comments.