void ParameterModifier(ParamModifierList m) { if (la.kind == 72) { Get(); m.Add(ParameterModifiers.In); } else if (la.kind == 69) { Get(); m.Add(ParameterModifiers.Ref); } else if (la.kind == 174) { Get(); m.Add(ParameterModifiers.Optional); } else if (la.kind == 182) { Get(); m.Add(ParameterModifiers.Params); } else SynErr(304); }
public void Add(ParamModifierList m) { Add(m.cur); }
void FormalParameter(out ParameterDeclarationExpression p) { AttributeSection section; List<AttributeSection> attributes = new List<AttributeSection>(); TypeReference type = null; ParamModifierList mod = new ParamModifierList(this); Expression expr = null; p = null; ArrayList arrayModifiers = null; Location startLocation = la.Location; while (la.kind == 40) { AttributeSection(out section); attributes.Add(section); } while (StartOf(29)) { ParameterModifier(mod); } Identifier(); string parameterName = t.val; if (IsDims()) { ArrayTypeModifiers(out arrayModifiers); } if (la.kind == 63) { Get(); TypeName(out type); } if(type != null) { if (arrayModifiers != null) { if (type.RankSpecifier != null) { Error("array rank only allowed one time"); } else { type.RankSpecifier = (int[])arrayModifiers.ToArray(typeof(int)); } } } if (la.kind == 20) { Get(); Expr(out expr); } mod.Check(); p = new ParameterDeclarationExpression(type, parameterName, mod.Modifier, expr); p.Attributes = attributes; p.StartLocation = startLocation; p.EndLocation = t.EndLocation; }