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

Function isMatchingArgumentType

src/simulate/debug_info.cpp:361–387  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

359 }
360
361 bool isMatchingArgumentType ( TypeInfo * argType, TypeInfo * passType) {
362 if (!passType) {
363 return false;
364 }
365 if ( argType->type==Type::anyArgument ) {
366 return true;
367 }
368 // compare types which don't need inference
369 auto tempMatters = argType->isImplicit() ? TemporaryMatters::no : TemporaryMatters::yes;
370 if ( !isSameType(argType, passType, RefMatters::no, ConstMatters::no, tempMatters, true) ) {
371 return false;
372 }
373 // can't pass non-ref to ref
374 if ( argType->isRef() && !passType->isRef() ) {
375 return false;
376 }
377 // ref types can only add constness
378 if (argType->isRef() && !argType->isConst() && passType->isConst()) {
379 return false;
380 }
381 // pointer types can only add constant
382 if (isPointer(argType) && !argType->isConst() && passType->isConst()) {
383 return false;
384 }
385 // all good
386 return true;
387 }
388
389 bool isSameType ( const TypeInfo * THIS,
390 const TypeInfo * decl,

Callers

nothing calls this directly

Calls 4

isSameTypeFunction · 0.85
isPointerFunction · 0.85
isRefMethod · 0.80
isConstMethod · 0.80

Tested by

no test coverage detected