generate method

dynamic generate([
  1. dynamic builder,
  2. dynamic output
])

Implementation

generate([builder, output]) {
  var node = this.node;
  var nodeTypeLength = builder.getTypeLength(node.getNodeType(builder));

  if (nodeTypeLength > 1) {
    var type = null;

    var componentsLength = this.getVectorLength();

    if (componentsLength >= nodeTypeLength) {
      // need expand the input node

      type = builder.getTypeFromLength(this.getVectorLength());
    }

    var nodeSnippet = node.build(builder, type);

    return "${nodeSnippet}.${this.components}";
  } else {
    // ignore components if node is a float

    return node.build(builder);
  }
}