Ejemplo n.º 1
0
        /// <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);
            }
        }
Ejemplo n.º 2
0
        /// <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);
            }
        }
Ejemplo n.º 3
0
        /// <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);
            }
        } 
Ejemplo n.º 4
0
        /// <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);
            }
        }