예제 #1
0
파일: Scopes.cs 프로젝트: elkawee/UShell
        public static void Test1_basic_LL_tests()
        {
            LL <int> empty_int = null;

            foreach (var node in empty_int.chain("foo", 3).chain("bar", 4).LIFO())
            {
                Console.WriteLine(node.name + " " + node.pay);                                                                                 // mainly to test chaining from null
            }
            // hmm thats neat :)
            // also single assignment. empty int is still null

            D.Assert(empty_int.LIFO().ToArray().SequenceEqual(new LL <int> [0]));
            D.Assert(empty_int.LIFO_shadowed().ToArray().SequenceEqual(new LL <int> [0]));
            AUX.AssertThrows <LL_Exception> (() => empty_int.findPay("any key -- the LL is empty "));

            var zing = ((LL <string>)null).
                       chain("v1", "val1").
                       chain("v2", "boioioioioiing").
                       chain("v1", "shadowed");

            foreach (var node in zing.LIFO_shadowed())
            {
                Console.WriteLine(node.name + " " + node.pay);
            }

            AUX.AssertThrows <LL_Exception> (() => zing.findNode("non present key"));

            Console.WriteLine("================= LL ok ============= ");
        }
예제 #2
0
파일: Scopes.cs 프로젝트: elkawee/UShell
        public CH_closedScope   close()
        {
            var R = orig_scope;

            foreach (var n in ownLL_head.LIFO_shadowed().Reverse())
            {
                R = R.decl(n.name, n.pay);
            }
            return(R);
        }
예제 #3
0
파일: Scopes.cs 프로젝트: elkawee/UShell
 public IEnumerable <Ref> external_refs() => externals.LIFO_shadowed().Select(LL2Ref);
예제 #4
0
파일: Scopes.cs 프로젝트: elkawee/UShell
 public IEnumerable <Ref> refs() => LL_head.LIFO_shadowed().Select(LL2Ref);