Exemple #1
0
        /// <summary>Tests if the attribute is valid for a <see cref="Value"/> on a given <see cref="FunctionAttributeIndex"/></summary>
        /// <param name="index">Attribute index to test if the attribute is valid on</param>
        /// <param name="value"><see cref="Value"/> </param>
        /// <returns><see lang="true"/> if the attribute is valid on the specified <paramref name="index"/> of the given <paramref name="value"/></returns>
        public bool IsValidOn(FunctionAttributeIndex index, Value value)
        {
            if (value == null)
            {
                throw new ArgumentNullException(nameof(value));
            }

            // for now all string attributes are valid everywhere as they are target dependent
            // (e.g. no way to verify the validity of an arbitrary without knowing the target)
            if (IsString)
            {
                return(value.IsCallSite || value.IsFunction); // TODO: Attributes on globals??
            }

            return(Kind.CheckAttributeUsage(index, value));
        }