Esempio n. 1
0
        public JavaScriptPlugin(string fileName)
        {
            PluginFile = fileName;

            _engine = new JintEngine();
            _engine.AddPermission(new FileIOPermission(PermissionState.Unrestricted));
            _engine.AllowClr = true;

            Properties = new PluginProperties(Path.GetFileName(PluginFile), PluginManager.PluginDirectoryPath);
            Properties.Load();

            _engine.SetParameter("properties", Properties);
            _engine.SetParameter("plugindir", PluginManager.PluginDirectoryPath);

            _engine.SetFunction("WriteToConsole", new Action <object>(Console.WriteLine));
            _engine.SetFunction("SubscribeToEvent", new Action <string, JsFunction>(SubscribeToEvent));
            _engine.SetFunction("UnsubscribeFromEvent", new Action <string>(UnsubscribeFromEvent));
            _engine.SetFunction("RegisterCommand", new Action <string, JsFunction>(RegisterCommand));
            _engine.SetFunction("UnregisterCommand", new Action <string>(UnregisterCommand));
            _engine.SetFunction("RegisterConsoleCommand", new Action <string, JsFunction>(RegisterConsoleCommand));
            _engine.SetFunction("UnregisterConsoleCommand", new Action <string>(UnregisterConsoleCommand));
            _engine.SetFunction("SendPacket", new Action <SharpStarClient, IPacket>(SendPacket));
            _engine.SetFunction("SendClientPacketToAll", new Action <IPacket>(SendClientPacketToAll));
            _engine.SetFunction("SendServerPacketToAll", new Action <IPacket>(SendServerPacketToAll));
            _engine.SetFunction("GetPlayerClients", new Func <IClient[]>(GetPlayerClients));
            _engine.SetFunction("GetServerClients", new Func <IClient[]>(GetServerClients));

            _engine.SetFunction("ToArray", new Func <JsArray, object[]>(JsArrayToArray));

            _registeredEvents          = new Dictionary <string, JsFunction>();
            _registeredCommands        = new Dictionary <string, JsFunction>();
            _registeredConsoleCommands = new Dictionary <string, JsFunction>();
        }
 private void InitEngine()
 {
     engine = JintCreator.Create();
     //.SetFunction("getMapValue", new Jint.Delegates.Func<string, string>(getMapValue));
     engine.SetParameter("ie", new JsBrowser(Window));
     engine.SetParameter("$", new Q(AppContext, Window));
 }
Esempio n. 3
0
        static void textEditor_RunBefore(object sender, EventArgs e)
        {
            codeRichEditor textEditor = sender as codeRichEditor;
            JintEngine     jint       = textEditor.JintEngine;

            WatiN.Core.Browser browser = new BrowserWindow(context.Browser);
            jint.SetParameter("ie", new JsBrowser(browser));
            jint.SetParameter("$", new Q(context, browser));
            jint.SetFunction("getMapValue", new Jint.Delegates.Func <string, string>(getMapValue));
            //jint.SetFunction("listprint", new Action<string>(listprint));
            //jint.SetFunction("tableprint", new Action<string>(tableprint));
            textEditor.FindForm().Tag = browser;
        }
Esempio n. 4
0
        static public JintEngine Create(IAppContext appcontext)
        {
            context = appcontext;
            JintEngine jint = Create();

            WatiN.Core.Browser browser = new BrowserWindow(context.Browser);
            jint.SetParameter("ie", new JsBrowser(browser));
            var q = new Q(context, browser);

            jint.SetParameter("$", q);
            jint.SetFunction("Var", new Jint.Delegates.Func <string, object>(q.GetVariable));
            jint.SetFunction("getMapValue", new Jint.Delegates.Func <string, string>(getMapValue));
            return(jint);
        }
Esempio n. 5
0
        static void Main(string[] args)
        {
            Stopwatch sw = new Stopwatch();

            // string script = new StreamReader(assembly.GetManifestResourceStream("Jint.Tests.Parse.coffeescript-debug.js")).ReadToEnd();
            JintEngine jint = new JintEngine()
                              // .SetDebugMode(true)
                              .DisableSecurity()
                              .SetFunction("print", new Action <object>(Console.WriteLine));

            sw.Reset();
            jint.SetMaxRecursions(50);
            jint.SetMaxSteps(10 * 1000);
            jint.SetParameter("val", double.NaN);

            sw.Start();
            try
            {
                Console.WriteLine(
                    jint.Run(File.ReadAllText(@"C:\Work\ravendb-2.5\SharedLibs\Sources\jint-22024d8a6e7a\Jint.Play\test.js")));
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
            finally
            {
                Console.WriteLine("{0}ms", sw.ElapsedMilliseconds);
            }
        }
Esempio n. 6
0
        public override void Load(string code)
        {
            Engine = new JintEngine(Options.Ecmascript5)
                     .AllowClr(true);

            Engine.SetParameter("Commands", chatCommands)
            .SetParameter("DataStore", DataStore.GetInstance())
            .SetParameter("Find", Find.GetInstance())
            .SetParameter("GlobalData", GlobalData)
            .SetParameter("Plugin", this)
            .SetParameter("Server", Server.GetInstance())
            .SetParameter("ServerConsoleCommands", consoleCommands)
            .SetParameter("Util", Util.GetInstance())
            .SetParameter("Web", Web)
            .SetParameter("World", World.GetInstance())
            .SetFunction("importClass", new importit(importClass));

            try {
                Program = JintEngine.Compile(code, false);

                Globals = (from statement in Program.Statements
                           where statement.GetType() == typeof(FunctionDeclarationStatement)
                           select((FunctionDeclarationStatement)statement).Name).ToList <string>();

                Engine.Run(Program);
                State = PluginState.Loaded;
            } catch (Exception ex) {
                Logger.LogException(ex);
                State = PluginState.FailedToLoad;
            }

            PluginLoader.GetInstance().OnPluginLoaded(this);
        }
Esempio n. 7
0
        static void Main(string[] args)
        {

            Stopwatch sw = new Stopwatch();

            // string script = new StreamReader(assembly.GetManifestResourceStream("Jint.Tests.Parse.coffeescript-debug.js")).ReadToEnd();
	        JintEngine jint = new JintEngine()
		        // .SetDebugMode(true)
		        .DisableSecurity()
		        .SetFunction("print", new Action<object>(Console.WriteLine));
            sw.Reset();
	        jint.SetMaxRecursions(50);
	        jint.SetMaxSteps(10*1000);
	        jint.SetParameter("val", double.NaN);

			sw.Start();
			try
			{
				Console.WriteLine(
					jint.Run(File.ReadAllText(@"C:\Work\ravendb-2.5\SharedLibs\Sources\jint-22024d8a6e7a\Jint.Play\test.js")));
			}
			catch (Exception e)
			{
				Console.WriteLine(e);
			}
	        finally 
	        {
				Console.WriteLine("{0}ms", sw.ElapsedMilliseconds);
			}

        }
Esempio n. 8
0
        public static void Main(String[] args)
        {
            Logger logger = new ConsoleLogger();

            Logging.SetLogger(logger);

            string     script = System.IO.File.ReadAllText(args[0]);
            JintEngine engine = new JintEngine();

            engine.SetParameter("language", "cs");
#if TEST_WINPHONE
            engine.SetParameter("platform", "winphone");
#else
            engine.SetParameter("platform", "windows");
#endif
            engine.SetParameter("util", new Util(engine));
            engine.Run(script);
        }
Esempio n. 9
0
 public void InitGlobals()
 {
     Engine.SetParameter("Server", Fougerite.Server.GetServer());
     Engine.SetParameter("Data", MagmaPlugin.Data.GetData());
     Engine.SetParameter("DataStore", Fougerite.DataStore.GetInstance());
     Engine.SetParameter("Util", Fougerite.Util.GetUtil());
     Engine.SetParameter("Web", new Fougerite.Web());
     Engine.SetParameter("Time", this);
     Engine.SetParameter("World", Fougerite.World.GetWorld());
     Engine.SetParameter("Plugin", this);
 }
            public void Invoke(string methodName, object[] parameters)
            {
                var jint = new JintEngine();

                jint.DisableSecurity();
                jint.Visitor.Usings.CopyFrom(_extension._usings);
                jint.SetParameter("ExtensionHooks", _extension.Hooks);
                jint.Run(_extension._script);
                jint.CallFunction(methodName, parameters);
            }
Esempio n. 11
0
        public object execute(params KeyValuePair <string, object>[] parameters)
        {
            JintEngine executor = new JintEngine();

            foreach (KeyValuePair <String, object> KeyVal in parameters)
            {
                executor.SetParameter(KeyVal.Key, KeyVal.Value);
            }
            executor.AllowClr = true;
            executor.DisableSecurity();
            return(executor.Run(@compiledCode, false));
        }
Esempio n. 12
0
 protected override void CustomizeEngine(JintEngine jintEngine)
 {
     jintEngine.SetParameter("documentId", docId);
     jintEngine.SetFunction("replicateTo", new Action <string, JsObject>(ReplicateToFunction));
     foreach (var sqlReplicationTable in config.SqlReplicationTables)
     {
         var current = sqlReplicationTable;
         jintEngine.SetFunction("replicateTo" + sqlReplicationTable.TableName, (Action <JsObject>)(cols =>
         {
             var tableName = current.TableName;
             ReplicateToFunction(tableName, cols);
         }));
     }
 }
Esempio n. 13
0
 protected override void CustomizeEngine(JintEngine jintEngine)
 {
     jintEngine.SetParameter("documentId", docId);
     jintEngine.SetFunction("sqlReplicate", (Action <string, string, JsObject>)((table, pkName, cols) =>
     {
         var itemToReplicates = dictionary.GetOrAdd(table);
         itemToReplicates.Add(new ItemToReplicate
         {
             PkName     = pkName,
             DocumentId = docId,
             Columns    = ToRavenJObject(cols)
         });
     }));
 }
Esempio n. 14
0
        static void Main2(string[] args)
        {
            List <MyClass> myClasses = new List <MyClass>();

            myClasses.Add(new MyClass("Some text", 2));
            myClasses.Add(new MyClass("More text", 1));

            var jintEngine = new JintEngine();

            jintEngine.SetParameter("myClasses", myClasses);

            Console.WriteLine("Result: {0}", jintEngine.Run("return myClasses[0].Description"));
            System.Console.ReadKey();
        }
Esempio n. 15
0
        public override void Load(string code = "")
        {
            try
            {
                Engine = new JintEngine(Options.Ecmascript5)
                         .AllowClr(true);

                Engine.SetParameter("Plugin", this)
                .SetParameter("Server", Fougerite.Server.GetServer())
                .SetParameter("DataStore", DataStore.GetInstance())
                .SetParameter("Data", Data.GetData())
                .SetParameter("Web", new Fougerite.Web())
                .SetParameter("Util", Util.GetUtil())
                .SetParameter("World", World.GetWorld())
                    #pragma warning disable 618
                .SetParameter("PluginCollector", GlobalPluginCollector.GetPluginCollector())
                    #pragma warning restore 618
                .SetParameter("Loom", Fougerite.Loom.Current)
                .SetParameter("JSON", Fougerite.JsonAPI.GetInstance)
                .SetParameter("MySQL", Fougerite.MySQLConnector.GetInstance)
                .SetParameter("SQLite", Fougerite.SQLiteConnector.GetInstance)
                .SetFunction("importClass", new importit(importClass));
                Program = JintEngine.Compile(code, false);

                Globals = (from statement in Program.Statements
                           where statement.GetType() == typeof(FunctionDeclarationStatement)
                           select((FunctionDeclarationStatement)statement).Name).ToList <string>();

                Engine.Run(Program);

                object author  = GetGlobalObject("Author");
                object about   = GetGlobalObject("About");
                object version = GetGlobalObject("Version");
                Author  = author == null || (string)author == "undefined" ? "Unknown" : author.ToString();
                About   = about == null || (string)about == "undefined" ? "" : about.ToString();
                Version = version == null || (string)version == "undefined" ? "1.0" : version.ToString();

                State = PluginState.Loaded;
            }
            catch (Exception ex)
            {
                Logger.LogError("[Error] Failed to load lua plugin: " + ex);
                State = PluginState.FailedToLoad;
                PluginLoader.GetInstance().CurrentlyLoadingPlugins.Remove(Name);
            }

            PluginLoader.GetInstance().OnPluginLoaded(this);
        }
Esempio n. 16
0
        public override void Load(string code)
        {
            try {
                if (CoreConfig.GetInstance().GetBoolValue("javascript", "checkHash") && !code.VerifyMD5Hash())
                {
                    Logger.LogDebug($"[{GetType().Name}] MD5Hash not found for: {Name}");
                    State = PluginState.HashNotFound;
                }
                else
                {
                    Engine = new JintEngine(Options.Ecmascript5)
                             .AllowClr(true);

                    Engine.SetParameter("DataStore", DataStore.GetInstance())
                    .SetParameter("GlobalData", GlobalData)
                    .SetParameter("Plugin", this)
                    .SetParameter("Util", Util.GetInstance())
                    .SetParameter("Web", Web)
                    .SetFunction("importClass", new importit(importClass));

                    AssignVariables();

                    Program = JintEngine.Compile(code, false);

                    Globals = (from statement in Program.Statements
                               where statement.GetType() == typeof(FunctionDeclarationStatement)
                               select((FunctionDeclarationStatement)statement).Name).ToList();

                    Engine.Run(Program);

                    object author  = GetGlobalObject("Author");
                    object about   = GetGlobalObject("About");
                    object version = GetGlobalObject("Version");
                    Author  = author == null ? "" : author.ToString();
                    About   = about == null ? "" : about.ToString();
                    Version = version == null ? "" : version.ToString();

                    State = PluginState.Loaded;
                }
            } catch (Exception ex) {
                Logger.LogException(ex);
                State = PluginState.FailedToLoad;
            }

            PluginLoader.GetInstance().OnPluginLoaded(this);
        }
Esempio n. 17
0
        private void OutputLog(JintEngine engine)
        {
            var arr = engine.GetParameter("debug_outputs") as JsArray;

            if (arr == null)
            {
                return;
            }
            for (int i = 0; i < arr.Length; i++)
            {
                var o = arr.get(i);
                if (o == null)
                {
                    continue;
                }
                Debug.Add(o.ToString());
            }
            engine.SetParameter("debug_outputs", engine.Global.ArrayClass.New());
        }
Esempio n. 18
0
        public void Run(string filename, string args)
        {
            var path = Path.Combine(ScriptDir, filename);

            if (!File.Exists(path))
            {
                return;
            }

            var script = File.ReadAllText(path);

            if (args != null)
            {
                en.SetParameter("args", args);
            }
            //en.SetFunction("deleteitem", new Action<int>((id) => {
            //    Console.WriteLine("deleteitem id = " + id.ToString());
            //}));
            object result = en.Run(script);
        }
Esempio n. 19
0
        public override void Load(string code = "")
        {
            try {
                Engine = new JintEngine(Options.Ecmascript5)
                         .AllowClr(true);

                Engine.SetParameter("Commands", chatCommands)
                .SetParameter("DataStore", DataStore.GetInstance())
                .SetParameter("Find", Find.GetInstance())
                .SetParameter("GlobalData", GlobalData)
                .SetParameter("Plugin", this)
                .SetParameter("Server", Server.GetInstance())
                .SetParameter("ServerConsoleCommands", consoleCommands)
                .SetParameter("Util", Util.GetInstance())
                .SetParameter("Web", Web)
                .SetParameter("World", World.GetInstance())
                .SetFunction("importClass", new importit(importClass));
                Program = JintEngine.Compile(code, false);

                Globals = (from statement in Program.Statements
                           where statement.GetType() == typeof(FunctionDeclarationStatement)
                           select((FunctionDeclarationStatement)statement).Name).ToList <string>();

                Engine.Run(Program);

                object author  = GetGlobalObject("Author");
                object about   = GetGlobalObject("About");
                object version = GetGlobalObject("Version");
                Author  = author == null ? "" : author.ToString();
                About   = about == null ? "" : about.ToString();
                Version = version == null ? "" : version.ToString();

                State = PluginState.Loaded;
            } catch (Exception ex) {
                Logger.LogException(ex);
                State = PluginState.FailedToLoad;
                PluginLoader.GetInstance().CurrentlyLoadingPlugins.Remove(Name);
            }

            PluginLoader.GetInstance().OnPluginLoaded(this);
        }
Esempio n. 20
0
        public void ShouldNotThrowOverflowExpcetion() {
            var jint = new JintEngine();
            jint.SetParameter("box", new Box());
            jint.Run("box.Write(new Date);");

        }
Esempio n. 21
0
 public void InitGlobals()
 {
     Engine.SetParameter("Server", Fougerite.Server.GetServer());
     Engine.SetParameter("Data", MagmaModule.Data.GetData());
     Engine.SetParameter("DataStore", Fougerite.DataStore.GetInstance());
     Engine.SetParameter("Util", Fougerite.Util.GetUtil());
     Engine.SetParameter("Web", new Fougerite.Web());
     Engine.SetParameter("Time", this);
     Engine.SetParameter("World", Fougerite.World.GetWorld());
     Engine.SetParameter("Plugin", this);
     Engine.SetParameter("PluginCollector", GlobalPluginCollector.GetPluginCollector());
     Engine.SetParameter("Loom", Loom.Current);
     Engine.SetParameter("JSON", JsonAPI.GetInstance);
     Engine.SetParameter("MySQL", MySQLConnector.GetInstance);
     Engine.SetParameter("SQLite", SQLiteConnector.GetInstance);
 }
Esempio n. 22
0
 public Jint.Native.JsInstance importClass(string type)
 {
     Engine.SetParameter(type.Split('.').Last(), Util.GetUtil().TryFindReturnType(type));
     return((Engine.Global as Jint.Native.JsDictionaryObject)[type.Split('.').Last()]);
 }
Esempio n. 23
0
 public void SetVariable(string name, object value)
 {
     m_engine.SetParameter(name, value);
 }
Esempio n. 24
0
 public void ShouldNotReproduceBug85418() {
     var engine = new JintEngine();
     engine.SetParameter("a", 4);
     Assert.AreEqual(4, engine.Run("a"));
     Assert.AreEqual(4d, engine.Run("4"));
     Assert.AreEqual(true, engine.Run("a == 4"));
     Assert.AreEqual(true, engine.Run("4 == 4"));
     Assert.AreEqual(true, engine.Run("a == a"));
 }
Esempio n. 25
0
        //public string PreprocessIncludes(string pluginSource, string directory)
        //{
        //    var lines = pluginSource.Split('\n');
        //
        //    foreach (var line in lines)
        //    {
        //        string trimmed = line.Trim();
        //
        //        if (!trimmed.StartsWith("#include \""))
        //            continue;
        //
        //        if (trimmed.Length < 11)
        //            continue;
        //
        //        string includeName = trimmed.Substring(10, trimmed.Length - 10 - 1);
        //
        //        string includePath = Path.Combine(directory, includeName);
        //        if (File.Exists(includePath))
        //            pluginSource = pluginSource.Replace(trimmed, PreprocessIncludes(File.ReadAllText(includePath), directory));
        //        else
        //        {
        //            Log.Error("Could not find file to include \"" + trimmed + "\" in plugin " + directory + ".");
        //            Log.Display();
        //            Environment.Exit(1);
        //        }
        //    }
        //
        //    return pluginSource;
        //}

        public void SetParameter(string name, object value)
        {
            engine.SetParameter(name, value);
        }
Esempio n. 26
0
        static void Main3(string[] args)
        {
            JintEngine engine = new JintEngine();

            engine.DisableSecurity();
            engine.Run("1;");
            Marshaller marshal = engine.Global.Marshaller;

            JsConstructor ctor = engine.Global.Marshaller.MarshalType(typeof(Baz));

            ((JsObject)engine.Global)["Baz"]   = ctor;
            ((JsObject)engine.Global)["Int32"] = engine.Global.Marshaller.MarshalType(typeof(Int32));

            JsObject o = new JsObject();

            o["abc"] = new JsString("sure", engine.Global.StringClass.PrototypeProperty);
            engine.SetParameter("o", o);
            engine.SetParameter("ts1", new TimeSpan(1000));
            engine.SetParameter("ts2", new TimeSpan(2000));

            engine.Run(@"
if (ts1 <= ts2) {
    System.Console.WriteLine('ts1 < ts2');
}
System.Console.WriteLine('{0}',o.abc);
System.Console.WriteLine('{0}',Jint.Temp.InfoType.Name);
");



            engine.Run(@"
System.Console.WriteLine('=========FEATURES==========');
var test = new Baz();
var val;
System.Console.WriteLine('test.Name: {0}', test.Name);
System.Console.WriteLine('test.CurrentValue: {0}', test.CurrentValue);

System.Console.WriteLine('Update object using method');
test.SetTimestamp(System.DateTime.Now);
System.Console.WriteLine('test.CurrentValue: {0}', test.CurrentValue);

System.Console.WriteLine('Update object using property');
test.CurrentValue = new System.DateTime(1980,1,1);
System.Console.WriteLine('test.CurrentValue: {0}', test.CurrentValue);

System.Console.WriteLine('Update object using field');
test.t = new System.DateTime(1980,1,2);
System.Console.WriteLine('test.CurrentValue: {0}', test.CurrentValue);


System.Console.WriteLine('Is instance of Baz: {0}', test instanceof Baz ? 'yes' : 'no' );
System.Console.WriteLine('Is instance of Object: {0}', test instanceof Object ? 'yes' : 'no' );
System.Console.WriteLine('Is instance of String: {0}', test instanceof String ? 'yes' : 'no' );

System.Console.WriteLine('Constant field Int32.MaxValue: {0}', Int32.MaxValue);

System.Console.WriteLine('========= INHERITANCE FROM A CLR TYPE ==========');
function Foo(name,desc) {
    Baz.call(this,name);

    this.Description = desc;
    this.SetTimestamp(System.DateTime.Now);
}

(function(){
    var func = new Function();
    func.prototype = Baz.prototype;
    Foo.prototype = new func();
    Foo.prototype.constructor = Foo;
})();

Foo.prototype.PrintInfo = function() {
    System.Console.WriteLine('{0}: {1} ({2})', this.Name,this.Description,this.t);
}

var foo = new Foo('Gib','Mega mann');
foo.PrintInfo();

System.Console.WriteLine('========= DUMP OBJECT ==========');

function ___StandAlone() {}

for (var prop in foo){
    try {
        val = foo[prop];
    } catch(err) {
        val = 'Exception: ' + err.toString();
    }
    System.Console.WriteLine('{0} = {1}',prop,val.toString());
}

System.Console.WriteLine('========= DUMP PROTOTYPE ==========');

foo = Foo.prototype;

for (var prop in foo){
    try {
        val = foo[prop];
    } catch(err) {
        val = 'Exception: ' + err.toString();
    }
    System.Console.WriteLine('{0} = {1}',prop,val.toString());
}

System.Console.WriteLine('========= DUMP OBJECT PROTOTYPE ==========');

foo = Object.prototype;

for (var prop in foo){
    try {
        val = foo[prop];
    } catch(err) {
        val = 'Exception: ' + err.toString();
    }
    System.Console.WriteLine('{0} = {1}',prop,val.toString());
}

System.Console.WriteLine('========= TYPE INFORMATION ==========');
//System.Console.WriteLine('[{1}] {0}', test.GetType().FullName, test.GetType().GUID);
for(var prop in Baz) {
    try {
        val = Baz[prop];
    } catch (err) {
        val = 'Exception: ' + err.toString();
    }

    System.Console.WriteLine('{0} = {1}',prop,val);
}

System.Console.WriteLine('========= PERFORMANCE ==========');
");
            int ticks = Environment.TickCount;

            engine.Run(@"
            var temp;
            for (var i = 0; i < 100000; i++)
                temp = new Baz('hi');
            ");

            Console.WriteLine("new objects: {0} ms", Environment.TickCount - ticks);

            ticks = Environment.TickCount;
            engine.Run(@"
            var temp = new Baz();
            var val = ToInt32(20);
            System.Console.WriteLine('Debug: {0} + {1} = {2}', '10', val, temp.Foo('10',val));
            for (var i = 0; i < 100000; i++)
                temp.Foo('10',val);
            ");

            Console.WriteLine("method call in {0} ms", Environment.TickCount - ticks);

            ticks = Environment.TickCount;
            engine.Run(@"
            var temp = new Baz();
            for (var i = 0; i < 100000; i++)
                temp.Foo();
            ");

            Console.WriteLine("method call without args {0} ms", Environment.TickCount - ticks);

            ticks = Environment.TickCount;
            engine.Run(@"
            var temp = new Baz();
            for (var i = 0; i < 100000; i++)
                temp.CurrentValue;
            ");

            Console.WriteLine("get property {0} ms", Environment.TickCount - ticks);

            ticks = Environment.TickCount;
            engine.Run(@"
            var temp = new Baz();
            for (var i = 0; i < 100000; i++)
                temp.t;
            ");

            Console.WriteLine("get field {0} ms", Environment.TickCount - ticks);

            ticks = Environment.TickCount;
            engine.Run(@"
            for (var i = 0; i < 100000; i++)
                /**/1;
            ");

            Console.WriteLine("empty loop {0} ms", Environment.TickCount - ticks);

            //JsInstance inst = ctor.Construct(new JsInstance[0], null, visitor);

            Console.ReadKey();

            return;
        }