예제 #1
0
        static void TestSunSpider()
        {
            var contents = File.ReadAllText(@"c:\projetos\breakaleg\sunspider\sunspider-test-contents.js");
            var prefix = File.ReadAllText(@"c:\projetos\breakaleg\sunspider\sunspider-test-prefix.js");
            var run = File.ReadAllText(@"c:\projetos\breakaleg\sunspider\sunspider-test-run.js");

            var c = new JSCompiler();

            var t = c.Parse(contents + prefix + run);
            var cx = new JSNames();
            t.Run(cx);

            var tc = cx.GetField("testContents");
            var ts = cx.GetField("tests");
            var ca = cx.GetField("categories");

            System.Console.Write(tc + " " + ts + " " + ca);
        }
예제 #2
0
 dynamic Run(string code, string ret)
 {
     var p = new JSCompiler();
     var c = p.Parse(code);
     var ctx = new JSNames();
     ctx.Run(c);
     if (ret != null)
     {
         var a = ctx.GetField(ret);
         return a != null ? a.Scalar : null;
     }
     return null;
 }