generate method

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

Implementation

generate([builder, output]) {
  var type = this.getNodeType(builder);

  var context = {"temp": false};
  var nodeProperty = new PropertyNode(null, type).build(builder);

  var nodeSnippet =
          new ContextNode(this.node /*, context*/).build(builder, 'bool'),
      ifSnippet = new ContextNode(this.ifNode, context).build(builder, type),
      elseSnippet =
          new ContextNode(this.elseNode, context).build(builder, type);

  builder.addFlowCode("""if ( ${nodeSnippet} ) {

\t\t${nodeProperty} = ${ifSnippet};

\t} else {

\t\t${nodeProperty} = ${elseSnippet};

\t}""");

  return nodeProperty;
}