Exemple #1
0
        private bool ParseParameterDeclaration(TokenReader reader, out ParameterDeclaration parameter)
        {
            List<string> parameterNames = new List<string>();
            parameter = null;
            Token start = reader.Peek();
            string parameterName = null;
            if (!this.ExpectIdentifier(reader, out parameterName))
            {
                return false;
            }

            parameterNames.Add(parameterName);
            Token tok = reader.Peek();
            while (tok.Is(Keyword.Comma))
            {
                reader.Read();
                if (!this.ExpectIdentifier(reader, out parameterName))
                {
                    return false;
                }

                parameterNames.Add(parameterName);
                tok = reader.Peek();
            }

            if (!this.Expect(reader, Keyword.Colon))
            {
                return false;
            }

            TypeReference type = null;
            if (!this.ParseTypeReference(reader, out type))
            {
                return false;
            }

            ParameterDeclaration parameterDecl = new ParameterDeclaration(
                start,
                parameterNames,
                type);

            parameter = parameterDecl;
            return true;
        }
Exemple #2
0
 public void AddParameter(ParameterDeclaration parameterDecl)
 {
     this.parameters.Add(parameterDecl);
 }