/
EvilBeaver
/
OneScript
Обзор
Документация
Войти
/
EvilBeaver
/
OneScript
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
develop
src/OneScript.Core/Contexts/BslMethodInfo.cs
64 строки
2 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; using System.Linq; using System.Reflection; namespace OneScript.Contexts { /// <summary> /// Информация о методе, который может быть вызван из 1Script /// </summary> public abstract class BslMethodInfo : MethodInfo, INameAndAliasProvider { private AnnotationHolder _annotations; public abstract string Alias { get; } protected AnnotationHolder Annotations { get { if (_annotations == default) _annotations = RetrieveAnnotations(); return _annotations; } } protected void SetAnnotations(AnnotationHolder annotations) { _annotations = annotations; } protected virtual AnnotationHolder RetrieveAnnotations() { return new AnnotationHolder(Array.Empty<object>()); } public override object[] GetCustomAttributes(bool inherit) { return Annotations.GetCustomAttributes(inherit); } public override object[] GetCustomAttributes(Type attributeType, bool inherit) { return Annotations.GetCustomAttributes(attributeType, inherit); } public override bool IsDefined(Type attributeType, bool inherit) { return Annotations.IsDefined(attributeType, inherit); } public override string ToString() { return $"{ReturnType} {Name}(${string.Join(',', GetParameters().Select(x=>x.ParameterType))})"; } } }