MCPcopy Create free account
hub / github.com/FlaxEngine/FlaxEngine / MMethod

Method MMethod

Source/Engine/Scripting/Runtime/DotNet.cpp:1464–1513  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1462}
1463
1464MMethod::MMethod(MClass* parentClass, StringAnsiView name, void* handle, int32 paramsCount, MMethodAttributes attributes)
1465 : _handle(handle)
1466 , _paramsCount(paramsCount)
1467 , _parentClass(parentClass)
1468 , _name(name)
1469 , _hasCachedAttributes(false)
1470 , _hasCachedSignature(false)
1471 , _attributes(&parentClass->GetAssembly()->Memory)
1472{
1473 switch (attributes & MMethodAttributes::MemberAccessMask)
1474 {
1475 case MMethodAttributes::Private:
1476 _visibility = MVisibility::Private;
1477 break;
1478 case MMethodAttributes::FamANDAssem:
1479 _visibility = MVisibility::PrivateProtected;
1480 break;
1481 case MMethodAttributes::Assembly:
1482 _visibility = MVisibility::Internal;
1483 break;
1484 case MMethodAttributes::Family:
1485 _visibility = MVisibility::Protected;
1486 break;
1487 case MMethodAttributes::FamORAssem:
1488 _visibility = MVisibility::ProtectedInternal;
1489 break;
1490 case MMethodAttributes::Public:
1491 _visibility = MVisibility::Public;
1492 break;
1493 default:
1494 CRASH;
1495 }
1496 _isStatic = (attributes & MMethodAttributes::Static) == MMethodAttributes::Static;
1497
1498#if COMPILE_WITH_PROFILER
1499 // Setup Tracy profiler entry (use assembly memory)
1500 const StringAnsiView className = parentClass->GetFullName();
1501 char* profilerName = (char*)parentClass->GetAssembly()->Memory.Allocate(className.Length() + _name.Length() + 3);
1502 Platform::MemoryCopy(profilerName, className.Get(), className.Length());
1503 profilerName[className.Length()] = ':';
1504 profilerName[className.Length() + 1] = ':';
1505 Platform::MemoryCopy(profilerName + className.Length() + 2, _name.Get(), _name.Length());
1506 profilerName[className.Length() + 2 + _name.Length()] = 0;
1507 ProfilerData.name = profilerName;
1508 ProfilerData.function = _name.Get();
1509 ProfilerData.file = nullptr;
1510 ProfilerData.line = 0;
1511 ProfilerData.color = 0;
1512#endif
1513}
1514
1515void MMethod::CacheSignature() const
1516{

Callers

nothing calls this directly

Calls 3

AllocateMethod · 0.45
LengthMethod · 0.45
GetMethod · 0.45

Tested by

no test coverage detected