MCPcopy Create free account
hub / github.com/csyonghe/Spire / VisitProgram

Method VisitProgram

Source/SpireCore/SemanticsVisitor.cpp:834–944  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

832 compSym->Implementations.Add(compImpl);
833 }
834 virtual RefPtr<ProgramSyntaxNode> VisitProgram(ProgramSyntaxNode * programNode) override
835 {
836 HashSet<String> funcNames;
837 this->program = programNode;
838 this->function = nullptr;
839 for (auto & s : program->Members)
840 {
841 symbolTable->globalDecls.AddIfNotExists(s->Name.Content, s.Ptr());
842 }
843 for (auto & s : program->GetTypeDefs())
844 VisitTypeDefDecl(s.Ptr());
845 for (auto & s : program->GetStructs())
846 {
847 if (!s->SemanticallyChecked)
848 {
849 VisitStruct(s.Ptr());
850 s->SemanticallyChecked = true;
851 }
852 }
853 for (auto & func : program->GetFunctions())
854 {
855 if (!func->SemanticallyChecked)
856 {
857 VisitFunctionDeclaration(func.Ptr());
858 if (funcNames.Contains(func->InternalName))
859 {
860 StringBuilder argList;
861 argList << "(";
862 bool first = true;
863 for (auto & param : func->GetParameters())
864 {
865 if (!first)
866 argList << ", ";
867 argList << param->Type->ToString();
868 first = false;
869 }
870 argList << ")";
871 getSink()->diagnose(func, Diagnostics::functionRedefinitionWithArgList, func->Name, argList.ProduceString());
872 }
873 else
874 funcNames.Add(func->InternalName);
875 }
876 }
877 for (auto & func : program->GetFunctions())
878 {
879 if (!func->SemanticallyChecked)
880 {
881 func->Accept(this);
882 func->SemanticallyChecked = true;
883 }
884 }
885 for (auto & pipeline : program->GetPipelines())
886 {
887 VisitPipeline(pipeline.Ptr());
888 }
889 for (auto & interfaceNode : program->GetInterfaces())
890 {
891 if (!interfaceNode->SemanticallyChecked)

Callers

nothing calls this directly

Calls 15

GetTypeDefsMethod · 0.80
GetStructsMethod · 0.80
GetFunctionsMethod · 0.80
diagnoseMethod · 0.80
ProduceStringMethod · 0.80
GetPipelinesMethod · 0.80
GetInterfacesMethod · 0.80
GetShadersMethod · 0.80
SortShadersMethod · 0.80
AddIfNotExistsMethod · 0.45
PtrMethod · 0.45
ContainsMethod · 0.45

Tested by

no test coverage detected