MCPcopy Create free account
hub / github.com/chipsalliance/Surelog / compile_parameter_declaration_

Method compile_parameter_declaration_

src/DesignCompile/CompileClass.cpp:797–841  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

795}
796
797bool CompileClass::compile_parameter_declaration_(const FileContent* fC,
798 NodeId id) {
799 NodeId list_of_type_assignments = fC->Child(id);
800 if (fC->Type(list_of_type_assignments) ==
801 VObjectType::paList_of_type_assignments ||
802 fC->Type(list_of_type_assignments) == VObjectType::paTYPE) {
803 // Type param
804 m_helper.compileParameterDeclaration(m_class, fC, list_of_type_assignments,
805 m_compileDesign, Reduce::No, false,
806 nullptr, false, false);
807
808 } else {
809 m_helper.compileParameterDeclaration(m_class, fC, id, m_compileDesign,
810 Reduce::No, false, nullptr, false,
811 false);
812 }
813
814 NodeId data_type_or_implicit = fC->Child(id);
815 NodeId list_of_param_assignments = fC->Sibling(data_type_or_implicit);
816 NodeId param_assignment = fC->Child(list_of_param_assignments);
817 while (param_assignment) {
818 NodeId var = fC->Child(param_assignment);
819 const std::string_view name = fC->SymName(var);
820 const std::pair<FileCNodeId, DesignComponent*>* prevDef =
821 m_class->getNamedObject(name);
822 if (prevDef) {
823 Location loc1(fC->getFileId(var), fC->Line(var), fC->Column(var),
824 m_symbols->registerSymbol(name));
825 const FileContent* prevFile = prevDef->first.fC;
826 NodeId prevNode = prevDef->first.nodeId;
827 Location loc2(prevFile->getFileId(prevNode), prevFile->Line(prevNode),
828 prevFile->Column(prevNode),
829 m_symbols->registerSymbol(name));
830 Error err(ErrorDefinition::COMP_MULTIPLY_DEFINED_PARAMETER, loc1, loc2);
831 m_errors->addError(err);
832 }
833
834 FileCNodeId fnid(fC, id);
835 m_class->addObject(VObjectType::paLocal_parameter_declaration, fnid);
836 m_class->addNamedObject(name, fnid, nullptr);
837
838 param_assignment = fC->Sibling(param_assignment);
839 }
840 return true;
841}
842
843bool CompileClass::compile_class_type_(const FileContent* fC, NodeId id) {
844 UHDM::Serializer& s = m_compileDesign->getSerializer();

Callers

nothing calls this directly

Calls 13

getNamedObjectMethod · 0.80
addNamedObjectMethod · 0.80
ChildMethod · 0.45
TypeMethod · 0.45
SiblingMethod · 0.45
SymNameMethod · 0.45
getFileIdMethod · 0.45
LineMethod · 0.45
ColumnMethod · 0.45
registerSymbolMethod · 0.45
addErrorMethod · 0.45

Tested by

no test coverage detected