Example #1
0
        internal override void EnsureModifierAndTypeSignatureConsistency()
        {
            bool            isStatic     = this.Modifiers.HasStatic;
            ClassDefinition classDef     = (ClassDefinition)this.Owner;
            ClassDefinition baseClass    = classDef.BaseClass;
            bool            hasBaseClass = baseClass != null;

            if (!isStatic && classDef.Modifiers.HasStatic)
            {
                throw new ParserException(this, "Cannot have non-static fields in a static class.");
            }

            if (hasBaseClass && baseClass.GetMember(this.NameToken.Value, true) != null)
            {
                throw new ParserException(this, "This field definition hides a member in a base class.");
            }
        }