Exemple #1
0
        public static CompiledScope CreateRootScope(string name, IDictionary <string, object?> parameters)
        {
            var scope = new CompiledScope(name, null);

            foreach (var key in parameters.Keys)
            {
                scope.DefineVariable(key, parameters[key]?.GetType() ?? typeof(object));
            }
            return(scope);
        }
Exemple #2
0
        internal static CompiledScope CreateDerivedRootScope(string name, params CompiledScope?[] scopes)
        {
            var newScope = new CompiledScope(name, null);

            foreach (var scope in scopes)
            {
                if (scope == null)
                {
                    continue;
                }
                foreach (var parameter in scope.Variables)
                {
                    if (newScope.TryGetVariable(parameter.Name, out _) == false)
                    {
                        newScope.DefineVariable(parameter);
                    }
                }
            }
            return(newScope);
        }