public void SetName(ContextId context, SymbolId name, object value) { int id = context.Id; EnsureDictionary(id); if (_attrs != null && id < _attrs.Count) { _attrs[id].CheckWritable(name); } _dicts[id][name] = value; }
/// <summary> /// Friend class: LanguageContext /// Shouldn't be public since the module contexts are baked into code contexts in the case the module is optimized. /// </summary> internal ModuleContext SetModuleContext(ContextId languageContextId, ModuleContext moduleContext) { if (languageContextId.Id >= _moduleContexts.Length) { Array.Resize(ref _moduleContexts, languageContextId.Id + 1); } ModuleContext original = Interlocked.CompareExchange <ModuleContext>(ref _moduleContexts[languageContextId.Id], moduleContext, null); return(original ?? moduleContext); }
public void SetName(ContextId context, SymbolId name, object value, ScopeMemberAttributes attrs) { int id = context.Id; EnsureDictionary(id); EnsureAttrDict(id); if (_attrs != null && id < _attrs.Count) { _attrs[id].CheckWritable(name); } _dicts[id][name] = value; _attrs[id].Set(name, attrs); }
/// <summary> /// Sets the name to the specified value for the current context. /// /// The name is an arbitrary object. /// </summary> public void SetObjectName(ContextId context, object name, object value, ScopeMemberAttributes attributes) { //int id = context.Id; //if (id == 0) { // if (_attrs != null) _attrs.CheckWritable(name); _dict.AddObjectKey(name, value); // if (attributes != ScopeMemberAttributes.None) { // if (_attrs == null) _attrs = new ScopeAttributeDictionary(); // _attrs.Set(name, attributes); // } //} else { // if (_contextScopes == null) _contextScopes = new ContextSensitiveScope(); // _contextScopes.SetObjectName(context, name, value, attributes); //} }
/// <summary> /// Sets a name that is only available in the specified context. /// /// Provides the ScopeMemberAttributes which should be set on the provided object. /// </summary> /// <exception cref="MemberAccessException">The name has already been published and marked as ReadOnly</exception> public void SetName(ContextId context, SymbolId name, object value, ScopeMemberAttributes attributes) { if (_attrs != null) { _attrs.CheckWritable(name); } if (context == ContextId.Empty) { SetName(name, value); } else { if (_contextScopes == null) { _contextScopes = new ContextSensitiveScope(); } _contextScopes.SetName(context, name, value, attributes); } }
public void SetObjectName(ContextId context, object name, object value, ScopeMemberAttributes attrs) { int id = context.Id; EnsureDictionary(id); if (attrs != ScopeMemberAttributes.None) { EnsureAttrDict(id); } if (_attrs != null && id < _attrs.Count) { _attrs[id].CheckWritable(name); } _dicts[id].AddObjectKey(name, value); if (attrs != ScopeMemberAttributes.None) { _attrs[id].Set(name, attrs); } }
/// <summary> /// Friend class: LanguageContext /// </summary> /// <param name="languageContextId"></param> /// <returns></returns> internal ModuleContext GetModuleContext(ContextId languageContextId) { return((languageContextId.Id < _moduleContexts.Length) ? _moduleContexts[languageContextId.Id] : null); }