DataType TypeParser::parseType(bool genericParam) { // Handle recursive types (pointer and array) switch (_helper->peek().type()) { case Token::Type::OperatorStar: return this->parsePointerType(genericParam); case Token::Type::PunctuationOpenBracket: return this->parseArrayType(genericParam); case Token::Type::PunctuationOpenParen: return this->parseFunctionOrTupleType(); case Token::Type::PunctuationOpenBrace: return this->parseClosureType(); case Token::Type::KeywordVararg: _helper->next(); return DataType(DataType::Kind::Vararg); default: break; } QualifiedName name = this->parseQualifiedName(); if (!name.valid()) { assert(0 && "Message: unable to parse qualified name as part of a type"); } DataType type; if (genericParam) { type = DataType(DataType::Kind::Generic); type.setName(name.to_s()); } else { type = _context->dataTypeForName(name.to_s()); } type = this->parseTypeSpecifiers(type); return this->applyTypePostfixes(type, genericParam); }