internal VsaItem(VsaEngine engine, string itemName, JSVsaItemType type, JSVsaItemFlag flag) { this.engine = engine; this.type = type; this.name = itemName; this.flag = flag; this.codebase = null; this.isDirty = true; }
public IJSVsaItem CreateItem(string name, JSVsaItemType itemType, JSVsaItemFlag itemFlag) { IJSVsaItem item2; if (this.isClosed) { throw new JSVsaException(JSVsaError.EngineClosed); } if (this.engine.IsRunning) { throw new JSVsaException(JSVsaError.EngineRunning); } this.TryObtainLock(); try { if ((itemType != JSVsaItemType.Reference) && !this.engine.IsValidIdentifier(name)) { throw new JSVsaException(JSVsaError.ItemNameInvalid); } foreach (object obj2 in this.items) { if (((VsaItem) obj2).Name.Equals(name)) { throw new JSVsaException(JSVsaError.ItemNameInUse); } } IJSVsaItem item = null; switch (itemType) { case JSVsaItemType.Reference: if (itemFlag != JSVsaItemFlag.None) { throw new JSVsaException(JSVsaError.ItemFlagNotSupported); } break; case JSVsaItemType.AppGlobal: if (itemFlag != JSVsaItemFlag.None) { throw new JSVsaException(JSVsaError.ItemFlagNotSupported); } goto Label_00E3; case JSVsaItemType.Code: if (itemFlag == JSVsaItemFlag.Class) { throw new JSVsaException(JSVsaError.ItemFlagNotSupported); } goto Label_010E; default: goto Label_012A; } item = new VsaReference(this.engine, name); goto Label_012A; Label_00E3: item = new VsaHostObject(this.engine, name, JSVsaItemType.AppGlobal); ((VsaHostObject) item).isVisible = true; goto Label_012A; Label_010E: item = new VsaStaticCode(this.engine, name, itemFlag); this.staticCodeBlockCount++; Label_012A: if (item != null) { this.items.Add(item); } else { throw new JSVsaException(JSVsaError.ItemTypeNotSupported); } this.engine.IsDirty = true; item2 = item; } finally { this.ReleaseLock(); } return item2; }
internal VsaStaticCode(VsaEngine engine, string itemName, JSVsaItemFlag flag) : base(engine, itemName, JSVsaItemType.Code, flag) { this.compiledClass = null; this.codeContext = new Context(new DocumentContext(this), ""); }
public IJSVsaItem CreateItem(string name, JSVsaItemType itemType, JSVsaItemFlag itemFlag) { IJSVsaItem item2; if (this.isClosed) { throw new JSVsaException(JSVsaError.EngineClosed); } if (this.engine.IsRunning) { throw new JSVsaException(JSVsaError.EngineRunning); } this.TryObtainLock(); try { if ((itemType != JSVsaItemType.Reference) && !this.engine.IsValidIdentifier(name)) { throw new JSVsaException(JSVsaError.ItemNameInvalid); } foreach (object obj2 in this.items) { if (((VsaItem)obj2).Name.Equals(name)) { throw new JSVsaException(JSVsaError.ItemNameInUse); } } IJSVsaItem item = null; switch (itemType) { case JSVsaItemType.Reference: if (itemFlag != JSVsaItemFlag.None) { throw new JSVsaException(JSVsaError.ItemFlagNotSupported); } break; case JSVsaItemType.AppGlobal: if (itemFlag != JSVsaItemFlag.None) { throw new JSVsaException(JSVsaError.ItemFlagNotSupported); } goto Label_00E3; case JSVsaItemType.Code: if (itemFlag == JSVsaItemFlag.Class) { throw new JSVsaException(JSVsaError.ItemFlagNotSupported); } goto Label_010E; default: goto Label_012A; } item = new VsaReference(this.engine, name); goto Label_012A; Label_00E3: item = new VsaHostObject(this.engine, name, JSVsaItemType.AppGlobal); ((VsaHostObject)item).isVisible = true; goto Label_012A; Label_010E: item = new VsaStaticCode(this.engine, name, itemFlag); this.staticCodeBlockCount++; Label_012A: if (item != null) { this.items.Add(item); } else { throw new JSVsaException(JSVsaError.ItemTypeNotSupported); } this.engine.IsDirty = true; item2 = item; } finally { this.ReleaseLock(); } return(item2); }