/
smwwiki
/
OneScript_fork
Обзор
Документация
Войти
/
smwwiki
/
OneScript_fork
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
develop
src/OneScript.Core/Contexts/AttachedContext.cs
45 строк
1 KB
Mr-Rm
fix #1451: обновление глобального скоупа при загрузке внешнего модуля
21 окт 2024, 21:53
21 окт 2024, 21:53
2d33f8a
Код
Авторство
О чём код?
/*---------------------------------------------------------- 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.Collections.Generic; namespace OneScript.Contexts { /// <summary> /// Класс контекста, который подключен в память машины. /// </summary> public sealed class AttachedContext { private IVariable[] _variables; private BslMethodInfo[] _methods; public AttachedContext(IAttachableContext source) { Instance = source; Attach(); } public void Attach() { Instance.OnAttach(out _variables, out _methods); } public AttachedContext(IAttachableContext target, IVariable[] vars) { Instance = target; _variables = vars; _methods = Array.Empty<BslMethodInfo>(); } public IReadOnlyList<IVariable> Variables => _variables; public IReadOnlyList<BslMethodInfo> Methods => _methods; public IAttachableContext Instance { get; } } }