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

Function findMatchingOptions

src/ast/ast_typedecl.cpp:4237–4262  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4235 }
4236
4237 void findMatchingOptions ( const TypeDeclPtr & type, vector<MatchingOptionError> & matching ) {
4238 if ( type->baseType == Type::option ) {
4239 // lets see if one of the argTypes is the same as the other
4240 for ( size_t ai=0, as=type->argTypes.size(); ai<as; ++ai ) {
4241 auto & argT = type->argTypes[ai];
4242 for ( size_t bi=ai+1; bi<as; ++bi ) {
4243 auto & argB = type->argTypes[bi];
4244 if ( argT->isSameType(*argB, RefMatters::yes, ConstMatters::yes, TemporaryMatters::yes, AllowSubstitute::no, true, false) ) {
4245 matching.push_back({type,argT,argB});
4246 goto found;
4247 }
4248 }
4249 }
4250 found:;
4251 } else {
4252 if ( type->firstType ) {
4253 findMatchingOptions(type->firstType, matching);
4254 }
4255 if ( type->secondType ) {
4256 findMatchingOptions(type->secondType, matching);
4257 }
4258 for ( auto & argT : type->argTypes ) {
4259 findMatchingOptions(argT, matching);
4260 }
4261 }
4262 }
4263}

Callers 1

implAddGenericFunctionFunction · 0.85

Calls 3

isSameTypeMethod · 0.80
sizeMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected