recursive
| 732 | |
| 733 | // recursive |
| 734 | void MSLGenerator::OutputStatements(int indent, HLSLStatement* statement) |
| 735 | { |
| 736 | // Main generator loop: called recursively |
| 737 | while (statement != NULL) { |
| 738 | // skip pruned statements |
| 739 | if (statement->hidden) { |
| 740 | statement = statement->nextStatement; |
| 741 | continue; |
| 742 | } |
| 743 | |
| 744 | // skip writing across multiple entry points |
| 745 | // skip writing some types across multiple entry points |
| 746 | if (CanSkipWrittenStatement(statement)) { |
| 747 | statement = statement->nextStatement; |
| 748 | continue; |
| 749 | } |
| 750 | statement->written = true; |
| 751 | |
| 752 | OutputAttributes(indent, statement->attributes); |
| 753 | |
| 754 | if (statement->nodeType == HLSLNodeType_Comment) { |
| 755 | HLSLComment* comment = static_cast<HLSLComment*>(statement); |
| 756 | m_writer.WriteLine(indent, "//%s", comment->text); |
| 757 | } |
| 758 | else if (statement->nodeType == HLSLNodeType_Declaration) { |
| 759 | HLSLDeclaration* declaration = static_cast<HLSLDeclaration*>(statement); |
| 760 | |
| 761 | if (declaration->assignment && declaration->assignment->nodeType == HLSLNodeType_FunctionCall) { |
| 762 | OutputFunctionCallStatement(indent, (HLSLFunctionCall*)declaration->assignment, declaration); |
| 763 | } |
| 764 | else { |
| 765 | m_writer.BeginLine(indent, declaration->fileName, declaration->line); |
| 766 | OutputDeclaration(declaration); |
| 767 | m_writer.EndLine(";"); |
| 768 | } |
| 769 | } |
| 770 | else if (statement->nodeType == HLSLNodeType_Struct) { |
| 771 | HLSLStruct* structure = static_cast<HLSLStruct*>(statement); |
| 772 | OutputStruct(indent, structure); |
| 773 | } |
| 774 | else if (statement->nodeType == HLSLNodeType_Buffer) { |
| 775 | HLSLBuffer* buffer = static_cast<HLSLBuffer*>(statement); |
| 776 | OutputBuffer(indent, buffer); |
| 777 | } |
| 778 | else if (statement->nodeType == HLSLNodeType_Function) { |
| 779 | HLSLFunction* function = static_cast<HLSLFunction*>(statement); |
| 780 | |
| 781 | if (!function->forward) { |
| 782 | OutputFunction(indent, function); |
| 783 | } |
| 784 | } |
| 785 | else if (statement->nodeType == HLSLNodeType_ExpressionStatement) { |
| 786 | HLSLExpressionStatement* expressionStatement = static_cast<HLSLExpressionStatement*>(statement); |
| 787 | HLSLExpression* expression = expressionStatement->expression; |
| 788 | |
| 789 | if (expression->nodeType == HLSLNodeType_FunctionCall) { |
| 790 | OutputFunctionCallStatement(indent, (HLSLFunctionCall*)expression, NULL); |
| 791 | } |
nothing calls this directly
no test coverage detected