public virtual object VisitInterfaceIndexerNode(InterfaceIndexerNode interfaceIndexerNode, object data) { stackMap.Push(interfaceIndexerNode); interfaceIndexerNode.Attributes.AcceptVisitor(this, data); interfaceIndexerNode.Params.AcceptVisitor(this, data); stackMap.Pop(); return(null); }
private BaseNode ParseInterfaceMember() { BaseNode ret = null; ParsePossibleAttributes(false); ParseModifiers(); switch (curtok.ID) { case TokenID.RCurly: break; case TokenID.Event: // event InterfaceEventNode node = new InterfaceEventNode(curtok); curInterface.Events.Add(node); ApplyAttributes(node); ApplyDocComment(node); node.Modifiers = curmods; curmods = Modifier.Empty; AssertAndAdvance(TokenID.Event); node.Type = ParseType(false); node.Names.Add(ParseQualifiedIdentifier(false, true, true)); AssertAndAdvance(TokenID.Semi); ret = node; break; default: IType type = ParseType(false); if (type == null) { ReportError("Expected type or ident in interface member definition."); } switch (curtok.ID) { case TokenID.This: { // interface indexer InterfaceIndexerNode iiNode = new InterfaceIndexerNode(curtok); curInterface.Indexers.Add(iiNode); ApplyAttributes(iiNode); ApplyDocComment(iiNode); iiNode.Type = type; Advance(); // over 'this' iiNode.Params = ParseParamList(TokenID.LBracket, TokenID.RBracket); bool hasGetter, hasSetter; NodeCollection<AttributeNode> getAttrs, setAttrs; ParseInterfaceAccessors(out hasGetter, out getAttrs, out hasSetter, out setAttrs); iiNode.HasGetter = hasGetter; if (getAttrs != null) iiNode.GetterAttributes = getAttrs; iiNode.HasSetter = hasSetter; if (setAttrs != null) iiNode.SetterAttributes = setAttrs; ret = iiNode; break; } default: QualifiedIdentifierExpression name = ParseQualifiedIdentifier(false, true, true); if (name == null || name.Expressions.Count == 0) { ReportError("Expected name or ident in member definition."); } switch (curtok.ID) { case TokenID.Less: case TokenID.LParen: // method InterfaceMethodNode mnode = new InterfaceMethodNode(curtok); curInterface.Methods.Add(mnode); ApplyAttributes(mnode); ApplyDocComment(mnode); mnode.Modifiers = curmods; curmods = Modifier.Empty; mnode.Names.Add(name); mnode.Type = type; ParsePossibleTypeParameterNode(true, true, false, true); //if generic applies type parameter collection to the node ApplyTypeParameters(mnode); // starts at LParen mnode.Params = ParseParamList(); ParsePossibleTypeParameterConstraintNode(mnode); ApplyTypeParameterConstraints(mnode); ret = mnode; AssertAndAdvance(TokenID.Semi); break; case TokenID.LCurly: { // property InterfacePropertyNode pnode = new InterfacePropertyNode(curtok); curInterface.Properties.Add(pnode); ApplyAttributes(pnode); ApplyDocComment(pnode); pnode.Modifiers = curmods; curmods = Modifier.Empty; pnode.Names.Add(name); pnode.Type = type; bool hasGetter, hasSetter; NodeCollection<AttributeNode> getAttrs, setAttrs; ParseInterfaceAccessors(out hasGetter, out getAttrs, out hasSetter, out setAttrs); pnode.HasGetter = hasGetter; if (getAttrs != null) pnode.GetterAttributes = getAttrs; pnode.HasSetter = hasSetter; if (setAttrs != null) pnode.SetterAttributes = setAttrs; ret = pnode; if (curtok.ID == TokenID.Semi) { AssertAndAdvance(TokenID.Semi); } break; } default: ReportError("Invalid interface member syntax."); break; } break; } break; } return ret; }
private void ParseInterfaceMember() { ParsePossibleAttributes(false); ParseModifiers(); switch (curtok.ID) { case TokenID.Event: // event InterfaceEventNode node = new InterfaceEventNode(curtok); curInterface.Events.Add(node); if (curAttributes.Count > 0) { node.Attributes = curAttributes; curAttributes = new NodeCollection<AttributeNode>(); } node.Modifiers = curmods; curmods = Modifier.Empty; AssertAndAdvance(TokenID.Event); node.Type = ParseType(); node.Names.Add(ParseQualifiedIdentifier(false, true, true)); AssertAndAdvance(TokenID.Semi); break; default: IType type = ParseType(); if (type == null) { ReportError("Expected type or ident in interface member definition."); } switch (curtok.ID) { case TokenID.This: // interface indexer InterfaceIndexerNode iiNode = new InterfaceIndexerNode(curtok); if (curAttributes.Count > 0) { iiNode.Attributes = curAttributes; curAttributes = new NodeCollection<AttributeNode>(); } iiNode.Type = type; Advance(); // over 'this' iiNode.Params = ParseParamList(TokenID.LBracket, TokenID.RBracket); bool hasGetter = false; bool hasSetter = false; ParseInterfaceAccessors(ref hasGetter, ref hasSetter); iiNode.HasGetter = hasGetter; iiNode.HasSetter = hasSetter; break; default: QualifiedIdentifierExpression name = ParseQualifiedIdentifier(false, true, true); if (name == null || name.Expressions.Expressions.Count == 0) { ReportError("Expected name or ident in member definition."); } switch (curtok.ID) { case TokenID.Less: case TokenID.LParen: // method InterfaceMethodNode mnode = new InterfaceMethodNode(curtok); curInterface.Methods.Add(mnode); if (curAttributes.Count > 0) { mnode.Attributes = curAttributes; curAttributes = new NodeCollection<AttributeNode>(); } mnode.Modifiers = curmods; curmods = Modifier.Empty; mnode.Names.Add(name); mnode.Type = type; ParsePossibleTypeParameterNode(true, true, false); //if generic applies type parameter collection to the node ApplyTypeParameters(mnode); // starts at LParen mnode.Params = ParseParamList(); ParsePossibleTypeParameterConstraintNode(mnode); ApplyTypeParameterConstraints(mnode); AssertAndAdvance(TokenID.Semi); break; case TokenID.LCurly: // property InterfacePropertyNode pnode = new InterfacePropertyNode(curtok); curInterface.Properties.Add(pnode); // these are the prop nodes if (curAttributes.Count > 0) { pnode.Attributes = curAttributes; curAttributes = new NodeCollection<AttributeNode>(); } pnode.Modifiers = curmods; curmods = Modifier.Empty; pnode.Names.Add(name); pnode.Type = type; bool pHasGetter = false; bool pHasSetter = false; ParseInterfaceAccessors(ref pHasGetter, ref pHasSetter); pnode.HasGetter = pHasGetter; pnode.HasSetter = pHasSetter; if (curtok.ID == TokenID.Semi) { AssertAndAdvance(TokenID.Semi); } break; default: ReportError("Invalid interface member syntax."); break; } break; } break; } }
public virtual object VisitInterfaceIndexerNode(InterfaceIndexerNode interfaceIndexerNode, object data) { stackMap.Push(interfaceIndexerNode); interfaceIndexerNode.Attributes.AcceptVisitor(this, data); interfaceIndexerNode.Params.AcceptVisitor(this, data); stackMap.Pop(); return null; }