// For non-interface types public ClassDecl( Identifier idName, TypeSig [] arSuper, // super class & implemented interfaces MethodDecl [] alMethods, PropertyDecl[] alProperties, FieldDecl[] alFields, EventDecl [] alEvents, TypeDeclBase[] alNestedTypes, Modifiers mods, bool fIsClass // true for class, false for struct ) { Debug.Assert(idName != null); Debug.Assert(alMethods != null); Debug.Assert(alFields != null); Debug.Assert(alProperties != null); Debug.Assert(alEvents != null); m_strName = idName.Text; m_arSuper = (arSuper == null) ? new TypeSig[0] : arSuper; m_alNestedTypes = (alNestedTypes == null) ? m_sEmptyTypeList : alNestedTypes; m_alMethods = alMethods; m_alProperties = alProperties; m_alFields = alFields; m_alEvents = alEvents; // @todo - this is wrong m_filerange = idName.Location; if (!fIsClass) // structs are implicitly sealed. mods.SetSealed(); m_mods = mods; m_genre = fIsClass ? TypeEntry.Genre.cClass : TypeEntry.Genre.cStruct; }
//----------------------------------------------------------------------------- // Partial parse an event // ** rules ** // EventDecl -> mods 'event' type id ';' //----------------------------------------------------------------------------- protected EventDecl PartialParseEventDecl( Modifiers mods) { FileRange f = this.BeginRange(); ReadExpectedToken(Token.Type.cEvent); NonRefTypeSig t = ParseTypeSig(); Identifier idName = ReadExpectedIdentifier(); ReadExpectedToken(Token.Type.cSemi); EventDecl node = new EventDecl(idName, t, mods); node.SetLocation(this.EndRange(f)); return node; }