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)); }