You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
487 B
32 lines
487 B
2 years ago
|
import TempNode from '../core/Node.js';
|
||
|
|
||
|
class ArrayElementNode extends TempNode {
|
||
|
|
||
|
constructor( node, indexNode ) {
|
||
|
|
||
|
super();
|
||
|
|
||
|
this.node = node;
|
||
|
this.indexNode = indexNode;
|
||
|
|
||
|
}
|
||
|
|
||
|
getNodeType( builder ) {
|
||
|
|
||
|
return this.node.getNodeType( builder );
|
||
|
|
||
|
}
|
||
|
|
||
|
generate( builder ) {
|
||
|
|
||
|
const nodeSnippet = this.node.build( builder );
|
||
|
const indexSnippet = this.indexNode.build( builder, 'uint' );
|
||
|
|
||
|
return `${nodeSnippet}[ ${indexSnippet} ]`;
|
||
|
|
||
|
}
|
||
|
|
||
|
}
|
||
|
|
||
|
export default ArrayElementNode;
|