MCPcopy Create free account
hub / github.com/alecazam/kram / OutputStatements

Method OutputStatements

hlslparser/src/MSLGenerator.cpp:734–911  ·  view source on GitHub ↗

recursive

Source from the content-addressed store, hash-verified

732
733// recursive
734void 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 }

Callers

nothing calls this directly

Calls 6

WriteLineMethod · 0.80
BeginLineMethod · 0.80
EndLineMethod · 0.80
WriteMethod · 0.80
WriteLineTaggedMethod · 0.80
GetExpressionValueMethod · 0.80

Tested by

no test coverage detected