Exemple #1
0
        internal static IValue Global(ListNode list, Scope scope)
        {
            Scope rootScope = scope;

            while (rootScope.Parent != null)
            {
                rootScope = rootScope.Parent;
            }

            IdentifierNode identifier = (IdentifierNode)list.Children[1];

            if (list.Children.Count == 2)
            {
                //TODO Should probably be eval once
                return(identifier.Eval(rootScope));
            }
            //TODO Should probably be eval once
            IValue value = list.Children[2].Eval(scope);

            rootScope[identifier.Name] = value;
            return(value);
        }