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);
        }
Exemplo n.º 2
0
 public bool TryGetProperty(string id, out SSPropertyInfo property)
 {
     property = null;
     if (HasProperty(id) == false)
     {
         return(false);
     }
     property = Properties[id];
     return(true);
 }
Exemplo n.º 3
0
        public SSPropertyInfo GetProperty(string id)
        {
            SSPropertyInfo property = null;

            if (_Properties == null)
            {
                _Properties = new Dictionary <string, SSPropertyInfo>();
            }
            if (_Properties.ContainsKey(id))
            {
                property = _Properties[id];
            }
            else
            {
                property = _GetProperty(id);
                if (property != null)
                {
                    _Properties[id] = property;
                }
            }

            return(property);
        }