Unverified Commit 3d07bacf authored by sunag's avatar sunag Committed by GitHub
Browse files

CondNode: Fix duplicate conditional (#27828)

No related merge requests found
Showing with 10 additions and 0 deletions
+10 -0
......@@ -41,11 +41,21 @@ class CondNode extends Node {
const type = this.getNodeType( builder );
const context = { tempWrite: false };
const nodeData = builder.getDataFromNode( this );
if ( nodeData.nodeProperty !== undefined ) {
return nodeData.nodeProperty;
}
const { ifNode, elseNode } = this;
const needsOutput = output !== 'void';
const nodeProperty = needsOutput ? property( type ).build( builder ) : '';
nodeData.nodeProperty = nodeProperty;
const nodeSnippet = contextNode( this.condNode/*, context*/ ).build( builder, 'bool' );
builder.addFlowCode( `\n${ builder.tab }if ( ${ nodeSnippet } ) {\n\n` ).addFlowTab();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment