/
EvilBeaver
/
OneScript
Обзор
Документация
Войти
/
EvilBeaver
/
OneScript
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
develop
src/OneScript.Core/Contexts/MemberInfoExtensions.cs
36 строк
1 KB
EvilBeaver
Большой рефакторинг коллекций и исправление ошибок
16 мар 2025, 23:39
16 мар 2025, 23:39
c8ef752
Код
Авторство
О чём код?
/*---------------------------------------------------------- This Source Code Form is subject to the terms of the Mozilla Public License, v.2.0. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/. ----------------------------------------------------------*/ using System.Reflection; using System.Runtime.CompilerServices; namespace OneScript.Contexts { public static class MemberInfoExtensions { public static bool IsByRef(this ParameterInfo parameter) { if (parameter is BslParameterInfo bslParam) return !bslParam.ExplicitByVal; return parameter.ParameterType.IsByRef || parameter.IsDefined(typeof(ByRefAttribute)); } [MethodImpl(MethodImplOptions.AggressiveInlining)] public static bool IsFunction(this MethodInfo method) { return method.ReturnType != typeof(void); } public static ParameterInfo[] GetBslParameters(this BslMethodInfo methodInfo) { return methodInfo is ContextMethodInfo { InjectsProcess: true } ? methodInfo.GetParameters()[1..]: methodInfo.GetParameters(); } } }