MCPcopy Create free account
hub / github.com/Nic30/hdlConvertor / visitFunction_specification

Method visitFunction_specification

src/vhdlConvertor/subProgramParser.cpp:75–96  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

73}
74
75std::unique_ptr<HdlFunctionDef> VhdlSubProgramParser::visitFunction_specification(
76 vhdlParser::Function_specificationContext *ctx) {
77 // function_specification:
78 // ( PURE IMPURE )? FUNCTION designator
79 // subprogram_header
80 // ( ( PARAMETER )? LPAREN formal_parameter_list RPAREN )? RETURN type_mark
81 // ;
82 auto designator = ctx->designator();
83 auto returnT = VhdlExprParser::visitType_mark(ctx->type_mark());
84 assert(returnT);
85
86 bool isOperator = VhdlLiteralParser::isStrDesignator(designator);
87 auto name = VhdlLiteralParser::visitDesignator(designator);
88
89 auto fpl = ctx->formal_parameter_list();
90 std::unique_ptr<std::vector<std::unique_ptr<HdlIdDef>>> paramList;
91 if (fpl)
92 paramList = visitFormal_parameter_list(fpl);
93
94 return create_object<HdlFunctionDef>(ctx, name, isOperator,
95 std::move(returnT), std::move(paramList));
96}
97
98std::unique_ptr<std::vector<std::unique_ptr<HdlIdDef>>> VhdlSubProgramParser::visitFormal_parameter_list(
99 vhdlParser::Formal_parameter_listContext *ctx) {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected