TypeIdentifierSyntax TypeIdentifierSyntax::withIdentifier(RC<TokenSyntax> NewIdentifier) const { assert(NewIdentifier->getTokenKind() == tok::identifier); auto NewRaw = getRaw()->replaceChild(Cursor::Identifier, NewIdentifier); return Data->replaceSelf<TypeIdentifierSyntax>(NewRaw); }
BalancedTokensSyntax BalancedTokensSyntax::addBalancedToken(RC<TokenSyntax> NewBalancedToken) const { #ifndef NDEBUG assert(NewBalancedToken->getTokenKind() != tok::l_paren); assert(NewBalancedToken->getTokenKind() != tok::r_paren); assert(NewBalancedToken->getTokenKind() != tok::l_square); assert(NewBalancedToken->getTokenKind() != tok::r_square); assert(NewBalancedToken->getTokenKind() != tok::l_brace); assert(NewBalancedToken->getTokenKind() != tok::r_brace); auto IsIdentifier = NewBalancedToken->getTokenKind() == tok::identifier; auto IsKeyword = NewBalancedToken->isKeyword(); auto IsLiteral = NewBalancedToken->isLiteral(); auto IsOperator = NewBalancedToken->isOperator(); auto IsPunctuation = NewBalancedToken->isPunctuation(); assert(IsIdentifier || IsKeyword || IsLiteral || IsOperator || IsPunctuation); #endif auto Layout = getRaw()->Layout; Layout.push_back(NewBalancedToken); auto NewRaw = RawSyntax::make(SyntaxKind::BalancedTokens, Layout, SourcePresence::Present); return Data->replaceSelf<BalancedTokensSyntax>(NewRaw); }
TupleTypeElementSyntax TupleTypeElementSyntax::withLabel(RC<TokenSyntax> NewLabel) const { assert(NewLabel->getTokenKind() == tok::identifier); auto NewRaw = getRaw()->replaceChild(Cursor::Label, NewLabel); return Data->replaceSelf<TupleTypeElementSyntax>(NewRaw); }
TypeAttributeSyntax TypeAttributeSyntax:: withRightParenToken(RC<TokenSyntax> NewRightParenToken) const { assert(NewRightParenToken->getTokenKind() == tok::r_paren); return Data->replaceChild<TypeAttributeSyntax>(NewRightParenToken, Cursor::RightParenToken); };
TypeAttributeSyntax TypeAttributeSyntax::withIdentifier(RC<TokenSyntax> NewIdentifier) const { assert(NewIdentifier->getTokenKind() == tok::identifier); return Data->replaceChild<TypeAttributeSyntax>(NewIdentifier, Cursor::Identifier); };