예제 #1
0
파일: General.cs 프로젝트: szensk/wul
        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);
        }