internal GlobalScope(GlobalScope parent, VsaEngine engine, bool isComponentScope) : base(parent) { this.componentScopes = null; this.recursive = false; this.isComponentScope = isComponentScope; if (parent == null) { this.globalObject = engine.Globals.globalObject; this.globalObjectTR = TypeReflector.GetTypeReflectorFor(Globals.TypeRefs.ToReferenceContext(this.globalObject.GetType())); base.fast = !(this.globalObject is LenientGlobalObject); } else { this.globalObject = null; this.globalObjectTR = null; base.fast = parent.fast; if (isComponentScope) { ((GlobalScope) base.parent).AddComponentScope(this); } } base.engine = engine; base.isKnownAtCompileTime = base.fast; this.evilScript = true; this.thisObject = this; this.typeReflector = TypeReflector.GetTypeReflectorFor(Globals.TypeRefs.ToReferenceContext(base.GetType())); if (isComponentScope) { engine.Scopes.Add(this); } }
internal ClassScope(AST name, GlobalScope scope) : base(scope) { this.name = name.ToString(); base.engine = scope.engine; base.fast = scope.fast; this.noExpando = true; base.isKnownAtCompileTime = true; this.owner = null; this.constructors = new JSConstructor[0]; ScriptObject parent = base.engine.ScriptObjectStackTop(); while (parent is WithObject) { parent = parent.GetParent(); } if (parent is ClassScope) { this.package = ((ClassScope) parent).GetPackage(); } else if (parent is PackageScope) { this.package = (PackageScope) parent; } else { this.package = null; } this.itemProp = null; this.outerClassField = null; this.inStaticInitializerCode = false; this.staticInitializerUsesEval = false; this.instanceInitializerUsesEval = false; }
public VsaEngine(bool fast) : base("JScript", "7.0.3300", true) { vsaItems = new VsaItems(this); detached = false; printSupported = false; engineInstance = new EngineInstance(this); engineInstance.Init(); // Set the global context to this engine if we are // the only engine instance in the system. Globals.SetContextEngine(this); // Create the global object that contains all of // the definitions in the engine's global scope. lenientGlobalObject = new LenientGlobalObject(this); // Create the global scope object. globalScope = new GlobalScope (null, lenientGlobalObject.globalObject); // Initialize the scope stack. scopeStack = new Object [8]; scopeStack[0] = globalScope; scopeStackSize = 1; currentScope = globalScope; }
public virtual Object GetObject(){ if (null == this.scope) if (null != this.parent) this.scope = new GlobalScope((GlobalScope)this.parent.GetObject(), this.engine, false); else this.scope = new GlobalScope(null, this.engine); return this.scope; }
internal VsaScriptScope(VsaEngine engine, string itemName, VsaScriptScope parent) : base(engine, itemName, (JSVsaItemType) 0x13, JSVsaItemFlag.None) { this.parent = parent; this.scope = null; this.items = new ArrayList(8); this.isCompiled = false; this.isClosed = false; }
internal VsaScriptScope(VsaEngine engine, string itemName, VsaScriptScope parent) : base(engine, itemName, (VsaItemType)(int)VSAITEMTYPE2.SCRIPTSCOPE, VsaItemFlag.None){ this.parent = parent; this.scope = null; this.items = new ArrayList(8); this.isCompiled = false; this.isClosed = false; }
internal void AddComponentScope(GlobalScope component) { if (this.componentScopes == null) { this.componentScopes = new ArrayList(); } this.componentScopes.Add(component); component.thisObject = this.thisObject; }
public static void JScriptPackage(String rootName, VsaEngine engine) { GlobalScope scope = ((IActivationObject)engine.ScriptObjectStackTop()).GetGlobalScope(); FieldInfo field = scope.GetLocalField(rootName); if (field == null) { field = scope.AddNewField(rootName, Namespace.GetNamespace(rootName, engine), FieldAttributes.Public | FieldAttributes.Literal); } }
internal override void Close() { foreach (Object item in this.items) { ((VsaItem)item).Close(); } this.items = null; this.parent = null; this.scope = null; this.isClosed = true; }
public static void JScriptImport(string name, VsaEngine engine) { int index = name.IndexOf('.'); string str = (index > 0) ? name.Substring(0, index) : name; GlobalScope globalScope = ((IActivationObject)engine.ScriptObjectStackTop()).GetGlobalScope(); if (globalScope.GetLocalField(str) == null) { FieldInfo info = globalScope.AddNewField(str, Namespace.GetNamespace(str, engine), FieldAttributes.Literal | FieldAttributes.Public); } engine.SetEnclosingContext(new WrappedNamespace(name, engine, false)); }
public static void JScriptImport(String name, VsaEngine engine) { int dotPos = name.IndexOf('.'); String rootName = dotPos > 0 ? name.Substring(0, dotPos) : name; GlobalScope scope = ((IActivationObject)engine.ScriptObjectStackTop()).GetGlobalScope(); FieldInfo field = scope.GetLocalField(rootName); if (field == null) { field = scope.AddNewField(rootName, Namespace.GetNamespace(rootName, engine), FieldAttributes.Public | FieldAttributes.Literal); } engine.SetEnclosingContext(new WrappedNamespace(name, engine, false)); }
internal void TranslateToIL() { if (this.block != null && this.compiledClass == null) { GlobalScope glob = (GlobalScope)this.engine.GetGlobalScope().GetObject(); this.engine.Globals.ScopeStack.Push(glob); try{ this.compiledClass = this.block.TranslateToILClass(this.engine.CompilerGlobals); }finally{ this.engine.Globals.ScopeStack.Pop(); } } }
internal void ReRun(GlobalScope scope) { foreach (object obj2 in this.items) { if (obj2 is VsaHostObject) { ((VsaHostObject)obj2).ReRun(scope); } } if (this.parent != null) { this.parent.ReRun(scope); } }
internal void ReRun(GlobalScope scope) { foreach (Object item in this.items) { if (item is VsaHostObject) { ((VsaHostObject)item).ReRun(scope); } } if (this.parent != null) { this.parent.ReRun(scope); } }
private void AddNamedItemNamespace() { GlobalScope scope = (GlobalScope)this.Scope.GetObject(); if (scope.isComponentScope) { scope = (GlobalScope)scope.GetParent(); } ScriptObject parent = scope.GetParent(); VsaNamedItemScope scope2 = new VsaNamedItemScope(this.GetObject(), parent, base.engine); scope.SetParent(scope2); scope2.SetParent(parent); }
public virtual Object GetObject() { if (null == this.scope) { if (null != this.parent) { this.scope = new GlobalScope((GlobalScope)this.parent.GetObject(), this.engine, false); } else { this.scope = new GlobalScope(null, this.engine); } } return(this.scope); }
public virtual object GetObject() { if (this.scope == null) { if (this.parent != null) { this.scope = new GlobalScope((GlobalScope)this.parent.GetObject(), base.engine, false); } else { this.scope = new GlobalScope(null, base.engine); } } return(this.scope); }
private void AddNamedItemNamespace() { GlobalScope current = (GlobalScope)this.Scope.GetObject(); //get the global scope object if (current.isComponentScope) { current = (GlobalScope)current.GetParent(); } ScriptObject parent = current.GetParent(); //this can be non null if the current scope is nested inside another VsaNamedItemScope namedItemNamespace = new VsaNamedItemScope(this.GetObject(), parent, this.engine); // insert into the prototype chain of the global scope object current.SetParent(namedItemNamespace); namedItemNamespace.SetParent(parent); }
public object GetObject() { if (scope == null) { if (parent == null) { scope = new GlobalScope(null, engine); } else { scope = new GlobalScope((GlobalScope)parent.GetObject(), engine, false); } } return(scope); }
internal void TranslateToIL() { if ((this.block != null) && (this.compiledClass == null)) { GlobalScope item = (GlobalScope)base.engine.GetGlobalScope().GetObject(); base.engine.Globals.ScopeStack.Push(item); try { this.compiledClass = this.block.TranslateToILClass(base.engine.CompilerGlobals, false); } finally { base.engine.Globals.ScopeStack.Pop(); } } }
internal void PartiallyEvaluate() { if (this.block != null && this.compiledClass == null) { GlobalScope glob = (GlobalScope)this.engine.GetGlobalScope().GetObject(); this.engine.Globals.ScopeStack.Push(glob); try{ this.block.PartiallyEvaluate(); if (this.engine.HasErrors && !this.engine.alwaysGenerateIL) { throw new EndOfFile(); } }finally{ this.engine.Globals.ScopeStack.Pop(); } } }
internal override void Run() { if (this.compiledClass != null) { GlobalScope scriptBlockScope = (GlobalScope)Activator.CreateInstance(this.GetCompiledType(), new Object[] { this.engine.GetGlobalScope().GetObject() }); this.engine.Globals.ScopeStack.Push(scriptBlockScope); try { MethodInfo main = this.compiledClass.GetMethod("Global Code"); try{ main.Invoke(scriptBlockScope, null); }catch (TargetInvocationException e) { throw e.InnerException; } }finally{ this.engine.Globals.ScopeStack.Pop(); } } }
internal void Parse() { if (this.block == null && this.compiledClass == null) { GlobalScope glob = (GlobalScope)this.engine.GetGlobalScope().GetObject(); //Provide for the possibility of forward references to declarations in code blocks yet to come. glob.evilScript = !glob.fast || this.engine.GetStaticCodeBlockCount() > 1; this.engine.Globals.ScopeStack.Push(glob); try{ JSParser p = new JSParser(this.codeContext); this.block = (ScriptBlock)p.Parse(); if (p.HasAborted) { this.block = null; } }finally{ this.engine.Globals.ScopeStack.Pop(); } } }
internal void PartiallyEvaluate() { if ((this.block != null) && (this.compiledClass == null)) { GlobalScope item = (GlobalScope)base.engine.GetGlobalScope().GetObject(); base.engine.Globals.ScopeStack.Push(item); try { this.block.PartiallyEvaluate(); if (base.engine.HasErrors && !base.engine.alwaysGenerateIL) { throw new EndOfFile(); } } finally { base.engine.Globals.ScopeStack.Pop(); } } }
internal override WrappedNamespace EvaluateAsWrappedNamespace(bool giveErrorIfNameInUse) { Namespace ns = Namespace.GetNamespace(this.name, this.Engine); GlobalScope scope = ((IActivationObject)Globals.ScopeStack.Peek()).GetGlobalScope(); FieldInfo field = giveErrorIfNameInUse ? scope.GetLocalField(this.name) : scope.GetField(this.name, BindingFlags.Public | BindingFlags.Static); if (field != null) { if (giveErrorIfNameInUse && (!field.IsLiteral || !(field.GetValue(null) is Namespace))) { this.context.HandleError(JSError.DuplicateName, true); } } else { field = scope.AddNewField(this.name, ns, FieldAttributes.Literal | FieldAttributes.Public); ((JSVariableField)field).type = new TypeExpression(new ConstantWrapper(Typeob.Namespace, this.context)); ((JSVariableField)field).originalContext = this.context; } return(new WrappedNamespace(this.name, this.Engine)); }
internal override WrappedNamespace EvaluateAsWrappedNamespace(bool giveErrorIfNameInUse) { Namespace namespace2 = Namespace.GetNamespace(base.name, base.Engine); GlobalScope globalScope = ((IActivationObject)base.Globals.ScopeStack.Peek()).GetGlobalScope(); FieldInfo info = giveErrorIfNameInUse ? globalScope.GetLocalField(base.name) : globalScope.GetField(base.name, BindingFlags.Public | BindingFlags.Static); if (info != null) { if (giveErrorIfNameInUse && (!info.IsLiteral || !(info.GetValue(null) is Namespace))) { base.context.HandleError(JSError.DuplicateName, true); } } else { info = globalScope.AddNewField(base.name, namespace2, FieldAttributes.Literal | FieldAttributes.Public); ((JSVariableField)info).type = new TypeExpression(new ConstantWrapper(Typeob.Namespace, base.context)); ((JSVariableField)info).originalContext = base.context; } return(new WrappedNamespace(base.name, base.Engine)); }
internal bool inStaticInitializerCode; //Set this to true when partially evaluating the initializer of a static variable, false otherwise internal ClassScope(AST name, GlobalScope scope) : base(scope) { //The parent must be set to a proper value before the class can be used. this.name = name.ToString(); this.engine = scope.engine; this.fast = scope.fast; this.noExpando = true; this.isKnownAtCompileTime = true; this.owner = null; //set by Class constructor this.constructors = new JSConstructor[0]; ScriptObject enclosingScope = this.engine.ScriptObjectStackTop(); while (enclosingScope is WithObject) enclosingScope = enclosingScope.GetParent(); if (enclosingScope is ClassScope) this.package = ((ClassScope)enclosingScope).GetPackage(); else if (enclosingScope is PackageScope) this.package = (PackageScope)enclosingScope; else this.package = null; this.itemProp = null; this.outerClassField = null; this.inStaticInitializerCode = false; }
internal void Parse() { if ((this.block == null) && (this.compiledClass == null)) { GlobalScope item = (GlobalScope)base.engine.GetGlobalScope().GetObject(); item.evilScript = !item.fast || (base.engine.GetStaticCodeBlockCount() > 1); base.engine.Globals.ScopeStack.Push(item); try { JSParser parser = new JSParser(this.codeContext); this.block = parser.Parse(); if (parser.HasAborted) { this.block = null; } } finally { base.engine.Globals.ScopeStack.Pop(); } } }
internal override void Run() { if (this.compiledClass != null) { GlobalScope item = (GlobalScope)Activator.CreateInstance(this.GetCompiledType(), new object[] { base.engine.GetGlobalScope().GetObject() }); base.engine.Globals.ScopeStack.Push(item); try { MethodInfo method = this.compiledClass.GetMethod("Global Code"); try { method.Invoke(item, null); } catch (TargetInvocationException exception) { throw exception.InnerException; } } finally { base.engine.Globals.ScopeStack.Pop(); } } }
internal GlobalScope(GlobalScope parent, VsaEngine engine, bool isComponentScope) : base(parent){ this.componentScopes = null; this.recursive = false; this.isComponentScope = isComponentScope; if (parent == null){ this.globalObject = engine.Globals.globalObject; this.globalObjectTR = TypeReflector.GetTypeReflectorFor(this.globalObject.GetType()); this.fast = !(this.globalObject is LenientGlobalObject); }else{ this.globalObject = null; this.globalObjectTR = null; this.fast = parent.fast; if (isComponentScope) ((GlobalScope)this.parent).AddComponentScope(this); } this.engine = engine; this.isKnownAtCompileTime = this.fast; this.evilScript = true; //True by default. Set it false when a single script block is being compiled. this.thisObject = this; this.typeReflector = TypeReflector.GetTypeReflectorFor(this.GetType()); if (isComponentScope) engine.Scopes.Add(this); }
public GlobalScope(GlobalScope parent, VsaEngine engine) : this(parent, engine, parent != null) { }
public override MemberInfo[] GetMembers(BindingFlags bindingAttr) { if (this.recursive) { return(new MemberInfo[0]); } MemberInfoList result = new MemberInfoList(); if (this.isComponentScope) { MemberInfo[] mems = Globals.TypeRefs.ToReferenceContext(this.GetType()).GetMembers(bindingAttr | BindingFlags.DeclaredOnly); if (mems != null) { foreach (MemberInfo mem in mems) { result.Add(mem); } } } else { if (this.componentScopes != null) { for (int i = 0, n = this.componentScopes.Count; i < n; i++) { GlobalScope sc = (GlobalScope)this.componentScopes[i]; this.recursive = true; MemberInfo[] mems = null; try { mems = sc.GetMembers(bindingAttr); } finally { this.recursive = false; } if (mems != null) { foreach (MemberInfo mem in mems) { result.Add(mem); } } } } IEnumerator enu = this.field_table.GetEnumerator(); while (enu.MoveNext()) { FieldInfo field = (FieldInfo)enu.Current; result.Add(field); } } if (this.parent != null && (this.isComponentScope || ((bindingAttr & BindingFlags.DeclaredOnly) == 0))) { this.recursive = true; MemberInfo[] mems = null; try { mems = ((ScriptObject)this.parent).GetMembers(bindingAttr); } finally { this.recursive = false; } if (mems != null) { foreach (MemberInfo mem in mems) { result.Add(mem); } } } return(result.ToArray()); }
private MemberInfo[] GetMember(String name, BindingFlags bindingAttr, bool calledFromParent) { if (this.recursive) { return(new MemberInfo[0]); } MemberInfo[] result = null; if (!this.isComponentScope) { //Look for an expando MemberInfo[] members = base.GetMember(name, bindingAttr | BindingFlags.DeclaredOnly); if (members.Length > 0) { return(members); } if (this.componentScopes != null) { for (int i = 0, n = this.componentScopes.Count; i < n; i++) { GlobalScope sc = (GlobalScope)this.componentScopes[i]; result = sc.GetMember(name, bindingAttr | BindingFlags.DeclaredOnly, true); if (result.Length > 0) { return(result); } } } if (this.globalObject != null) { result = this.globalObjectTR.GetMember(name, bindingAttr & ~BindingFlags.NonPublic | BindingFlags.Static); } if (result != null && result.Length > 0) { return(ScriptObject.WrapMembers(result, this.globalObject)); } } else { //Look for global variables represented as static fields on subclass of GlobalScope. I.e. the script block case. result = this.typeReflector.GetMember(name, bindingAttr & ~BindingFlags.NonPublic | BindingFlags.Static); int n = result.Length; if (n > 0) { int toBeHidden = 0; MemberInfo[] newResult = new MemberInfo[n]; for (int i = 0; i < n; i++) { MemberInfo mem = newResult[i] = result[i]; if (mem.DeclaringType.IsAssignableFrom(Typeob.GlobalScope)) { newResult[i] = null; toBeHidden++; } else if (mem is FieldInfo) { FieldInfo field = (FieldInfo)mem; if (field.IsStatic && field.FieldType == Typeob.Type) { Type t = (Type)field.GetValue(null); if (t != null) { newResult[i] = t; } } } } if (toBeHidden == 0) { return(result); } if (toBeHidden == n) { return(new MemberInfo[0]); } MemberInfo[] remainingMembers = new MemberInfo[n - toBeHidden]; int j = 0; foreach (MemberInfo mem in newResult) { if (mem != null) { remainingMembers[j++] = mem; } } return(remainingMembers); } } if (this.parent != null && !calledFromParent && ((bindingAttr & BindingFlags.DeclaredOnly) == 0 || this.isComponentScope)) { this.recursive = true; try { result = ((ScriptObject)this.parent).GetMember(name, bindingAttr); } finally { this.recursive = false; } if (result != null && result.Length > 0) { return(result); } } return(new MemberInfo[0]); }
public object GetObject() { if (scope == null) if (parent == null) { scope = new GlobalScope (null, engine); } else { scope = new GlobalScope ((GlobalScope) parent.GetObject (), engine, false); } return scope; }
internal void ReRun(GlobalScope scope){ foreach (Object item in this.items) if (item is VsaHostObject) ((VsaHostObject)item).ReRun(scope); if (this.parent != null) this.parent.ReRun(scope); }
internal override void Close(){ foreach (Object item in this.items) ((VsaItem)item).Close(); this.items = null; this.parent = null; this.scope = null; this.isClosed = true; }
internal override void Close() { foreach (object obj2 in this.items) { ((VsaItem) obj2).Close(); } this.items = null; this.parent = null; this.scope = null; this.isClosed = true; }
internal void ReRun(GlobalScope scope) { if (this.field is JSGlobalField) { ((JSGlobalField) this.field).ILField = scope.GetField(base.name, BindingFlags.Public | BindingFlags.Static); this.field.SetValue(scope, this.GetObject()); this.field = null; } }
public GlobalScope(GlobalScope parent, VsaEngine engine) : this(parent, engine, engine != null) { this.elems = new Hashtable(); this.property_cache = new Hashtable(); }
internal GlobalScope(GlobalScope parent, VsaEngine engine, bool is_comp_scope) { this.elems = new Hashtable(); this.parent = parent; this.engine = engine; }
// Constructor. public GlobalScope(GlobalScope parent, ScriptObject storage) : base(parent, storage) { // Nothing else to do here. }
public GlobalScope(GlobalScope parent, VsaEngine engine) : base(parent, (parent == null && engine != null ? engine.LenientGlobalObject.globalObject : null)) { // Nothing else to do here. }
internal ScriptBlock(Context context, Block statement_block) : base(context) { this.statement_block = statement_block; this.own_scope = (GlobalScope) base.Engine.ScriptObjectStackTop(); this.fields = null; }
internal void AddComponentScope(GlobalScope component){ if (this.componentScopes == null) this.componentScopes = new ArrayList(); this.componentScopes.Add(component); component.thisObject = this.thisObject; //Component scopes pretend they are one and the same as their parent scope. }
public virtual object GetObject() { if (this.scope == null) { if (this.parent != null) { this.scope = new GlobalScope((GlobalScope) this.parent.GetObject(), base.engine, false); } else { this.scope = new GlobalScope(null, base.engine); } } return this.scope; }
public GlobalScope(GlobalScope parent, VsaEngine engine) : this(parent, engine, parent != null) { }
internal void ReRun(GlobalScope scope) { foreach (object obj2 in this.items) { if (obj2 is VsaHostObject) { ((VsaHostObject) obj2).ReRun(scope); } } if (this.parent != null) { this.parent.ReRun(scope); } }
internal ScriptBlock(Context context, Block statement_block) : base(context) { this.statement_block = statement_block; this.own_scope = (GlobalScope)base.Engine.ScriptObjectStackTop(); this.fields = null; }
// Constructor. public GlobalScope(GlobalScope parent, ScriptObject storage) : base(parent, storage) { // Nothing else to do here. }
public GlobalScope(GlobalScope parent, VsaEngine engine) : this(parent, engine, engine != null) { this.elems = new Hashtable (); this.property_cache = new Hashtable (); }
internal GlobalScope(GlobalScope parent, VsaEngine engine, bool is_comp_scope) { this.elems = new Hashtable (); this.parent = parent; this.engine = engine; }
public PartialTrustEvaluationStrategy(string expression, VsaEngine engine) : base(engine) { // // Following is equivalent to declaring a "var" in JScript // at the level of the Global object. // _scope = (GlobalScope)engine.GetGlobalScope().GetObject(); _contextField = _scope.AddField("$context"); _expression = expression; }
public override MemberInfo[] GetMembers(BindingFlags bindingAttr) { if (this.recursive) { return(new MemberInfo[0]); } MemberInfoList list = new MemberInfoList(); if (this.isComponentScope) { MemberInfo[] members = Globals.TypeRefs.ToReferenceContext(base.GetType()).GetMembers(bindingAttr | BindingFlags.DeclaredOnly); if (members != null) { foreach (MemberInfo info in members) { list.Add(info); } } } else { if (this.componentScopes != null) { int num = 0; int count = this.componentScopes.Count; while (num < count) { GlobalScope scope = (GlobalScope)this.componentScopes[num]; this.recursive = true; MemberInfo[] infoArray2 = null; try { infoArray2 = scope.GetMembers(bindingAttr); } finally { this.recursive = false; } if (infoArray2 != null) { foreach (MemberInfo info2 in infoArray2) { list.Add(info2); } } num++; } } IEnumerator enumerator = base.field_table.GetEnumerator(); while (enumerator.MoveNext()) { FieldInfo current = (FieldInfo)enumerator.Current; list.Add(current); } } if ((base.parent != null) && (this.isComponentScope || ((bindingAttr & BindingFlags.DeclaredOnly) == BindingFlags.Default))) { this.recursive = true; MemberInfo[] infoArray3 = null; try { infoArray3 = base.parent.GetMembers(bindingAttr); } finally { this.recursive = false; } if (infoArray3 != null) { foreach (MemberInfo info4 in infoArray3) { list.Add(info4); } } } return(list.ToArray()); }
public GlobalScope(GlobalScope parent, VsaEngine engine) : base(parent, (parent == null && engine != null ? engine.LenientGlobalObject.globalObject : null)) { // Nothing else to do here. }
public Evaluator(Evaluator theEvaluator) { ICodeCompiler compiler; compiler = new JScriptCodeProvider().CreateCompiler(); CompilerParameters parameters; parameters = new CompilerParameters(); parameters.GenerateInMemory = true; CompilerResults results; results = compiler.CompileAssemblyFromSource(parameters, _jscriptSource); Assembly assembly = results.CompiledAssembly; _evaluatorType = assembly.GetType("EvaluatorNS.Evaluator"); //_evaluatorCtxType = assembly.GetType("Evaluator.Context"); _evaluator = Activator.CreateInstance(_evaluatorType); // create a new form instance // _scriptableForm = new ScriptableForm(); // create a new set of hosts lock (hosts) { string rootMoniker = string.Format("{0}://{1}", rootHostName, Guid.NewGuid().ToString()); _host = new VsaScriptingHost(VsaScriptingLanguages.JScript, "Evaluator", rootMoniker, _evaluatorType.Namespace, true); Engine = (VsaEngine)(object)_host.Engine; globalScope = Engine.GetGlobalScope(); thisGlobalObj = Microsoft.JScript.Eval.JScriptEvaluate("this;", Engine) as GlobalScope; hosts.Add(_host); _host.AddType(typeof(System.Object)); _host.AddType(typeof(System.String)); AddGlobalItem("$engine", Engine); AddGlobalItem("$superE", theEvaluator); // hosts.AddRange(HostFactory.Create(@"MyScriptingHost", @"Scripting", true, Environment.CurrentDirectory)); } // wire up to the events of each host foreach (VsaScriptingHost host in hosts) { host.AssemblyReferencesNeeded += new ScriptingHostEventHandler(OnAssemblyReferencesNeeded); host.CompilerException += new ScriptingHostCompilerExceptionEventHandler(OnCompilerException); host.GlobalItemsNeeded += new ScriptingHostEventHandler(OnGlobalItemsNeeded); } // execute the hosts foreach (VsaScriptingHost host in hosts) host.Execute(); // show the form //_scriptableForm.ShowDialog(); }