MCPcopy Create free account
hub / github.com/GaijinEntertainment/daScript / implAddGenericFunction

Function implAddGenericFunction

src/parser/parser_impl.cpp:690–707  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

688 }
689
690 void implAddGenericFunction ( yyscan_t scanner, Function * func ) {
691 for ( auto & arg : func->arguments ) {
692 vector<MatchingOptionError> optionErrors;
693 findMatchingOptions(arg->type, optionErrors);
694 if ( !optionErrors.empty() ) {
695 for ( auto & opt : optionErrors ) {
696 // opt.type has matching options opt.option1 and opt.option2
697 das_yyerror(scanner,"generic function argument " + arg->name + " of type " + opt.optionType->describe()
698 + " has matching options " + opt.option1->describe() + " and " + opt.option2->describe(),
699 opt.optionType->at, CompilationError::ambiguous_function_argument_type);
700 }
701 }
702 }
703 if ( !yyextra->g_Program->addGeneric(func) ) {
704 das_yyerror(scanner,"generic function is already defined " + func->getMangledName(),
705 func->at, CompilationError::already_declared_function);
706 }
707 }
708
709 vector<VariableDeclaration*> * ast_structVarDef ( yyscan_t scanner, vector<VariableDeclaration*> * list,
710 AnnotationList * annL, bool isStatic, bool isPrivate, int ovr, bool cnst, Function * func, Expression * block,

Callers 4

yyparseFunction · 0.85
yyparseFunction · 0.85
ast_structVarDefFunction · 0.85
yyparseFunction · 0.85

Calls 6

findMatchingOptionsFunction · 0.85
das_yyerrorFunction · 0.70
emptyMethod · 0.45
describeMethod · 0.45
addGenericMethod · 0.45
getMangledNameMethod · 0.45

Tested by

no test coverage detected