private List<AssociativeNode> GetAstsForBranch(int branch, List<AssociativeNode> inputAstNodes, bool verboseLogging, AstBuilder builder) { // Get all upstream nodes and then remove nodes that are not var nodes = GetInScopeNodesForInport(branch, false).Where(n => !(n is Symbol)); nodes = ScopedNodeModel.GetNodesInTopScope(nodes); // The second parameter, isDeltaExecution, is set to false so that // all AST nodes will be added to this IF graph node instead of // adding to the corresponding graph node. var allAstNodes = builder.CompileToAstNodes(nodes, Dynamo.Engine.AstBuilder.CompilationContext.None, verboseLogging); var astNodes = allAstNodes.SelectMany(t => t.Item2).ToList(); astNodes.Add(AstFactory.BuildReturnStatement(inputAstNodes[branch])); return astNodes; }