public virtual object VisitParameterDeclarationExpression(ParamDeclNode parameterDeclarationExpression, object data) { stackMap.Push(parameterDeclarationExpression); parameterDeclarationExpression.Attributes.AcceptVisitor(this, data); parameterDeclarationExpression.Type.AcceptVisitor(this, data); stackMap.Pop(); return(null); }
private ParamDeclNode ParseParamDecl() { ParamDeclNode node = new ParamDeclNode(curtok); ParsePossibleAttributes(false); if (curAttributes.Count > 0) { node.Attributes = curAttributes; curAttributes = new NodeCollection<AttributeNode>(); } node.Type = ParseType(); if (curtok.ID == TokenID.Ident) { node.Name = strings[curtok.Data]; Advance(); } else { RecoverFromError("Expected arg name.", TokenID.Ident); } return node; }
private ParamDeclNode ParseParamDecl() { ParamDeclNode node = new ParamDeclNode(curtok); ParsePossibleAttributes(false); if (curAttributes.Count > 0) { node.Attributes = curAttributes; curAttributes = new NodeCollection<AttributeNode>(); } /* ExpressionNode type = ParseExpressionOrType(true); if(!(type is TypeNode)) { ReportError("Type expected", ((BaseNode) node.Type).RelatedToken); return node; } node.Type = (IType) type;*/ TypeNode tn = ParseType(false); CheckRankSpecifier(tn); node.Type = tn; if (curtok.ID == TokenID.Ident) { node.Name = strings[curtok.Data]; Advance(); } else { RecoverFromError("Expected arg name.", TokenID.Ident); } return node; }
private NodeCollection<ParamDeclNode> ParseParamList(TokenID openToken, TokenID closeToken) { AssertAndAdvance(openToken); if (curtok.ID == closeToken) { Advance(); return null; } NodeCollection<ParamDeclNode> result = new NodeCollection<ParamDeclNode>(); bool isParams; bool hasComma; do { ParamDeclNode node = new ParamDeclNode(curtok); result.Add(node); isParams = false; ParsePossibleAttributes(false); if (isAnonynous > 0 && curAttributes.Count > 0) { ReportError("Attributes are not allowed for anonymous delegate's parameters."); } if (curtok.ID == TokenID.Ref) { node.Modifiers |= Modifier.Ref; Advance(); } else if (curtok.ID == TokenID.Out) { node.Modifiers |= Modifier.Out; Advance(); } else if (curtok.ID == TokenID.Params) { if (isAnonynous > 0) { ReportError("Params parameter are not allowed for anonymous delegate."); } isParams = true; node.Modifiers |= Modifier.Params; Advance(); } node.Type = ParseType(); if (isParams) { // ensure is array type } if (curtok.ID == TokenID.Ident) { node.Name = ((IdentifierExpression)ParseIdentifierOrKeyword(false, false, false, false)).Identifier;//strings[curtok.Data]; } hasComma = false; if (curtok.ID == TokenID.Comma) { Advance(); hasComma = true; } } while (!isParams && hasComma); AssertAndAdvance(closeToken); return result; }
public virtual object VisitParameterDeclarationExpression(ParamDeclNode parameterDeclarationExpression, object data) { stackMap.Push(parameterDeclarationExpression); parameterDeclarationExpression.Attributes.AcceptVisitor(this, data); parameterDeclarationExpression.Type.AcceptVisitor(this, data); stackMap.Pop(); return null; }