Exemplo n.º 1
0
        internal bool GetStaticPropertyOrField(string id, out HybInstance value, AccessLevel accessLevel)
        {
            SSPropertyInfo property = GetProperty(id);

            if (property != null)
            {
                if (property.AccessModifier.IsAcceesible(accessLevel) == false)
                {
                    throw new SemanticViolationException($"Invalid access: {id}");
                }
                value = property.GetMethod.Invoke(null, new HybInstance[] { });
                return(true);
            }

            SSFieldInfo field = GetField(id);

            if (field != null)
            {
                if (field.AccessModifier.IsAcceesible(accessLevel) == false)
                {
                    throw new SemanticViolationException($"Invalid access: {id}");
                }
                value = field.GetValue(null);
                return(true);
            }

            value = null;
            return(false);
        }