Convert generic-requirement-list to SyntaxCollection, implement function-declaration

This mostly wraps up the first cut of function-declaration.

https://bugs.swift.org/browse/SR-4043
This commit is contained in:
David Farler
2017-03-02 17:01:18 -08:00
parent ceb3babbc6
commit bb4253e3d3
8 changed files with 234 additions and 102 deletions

View File

@@ -44,8 +44,18 @@ DeclModifierSyntaxData(const RC<RawSyntax> Raw,
: SyntaxData(Raw, Parent, IndexInParent) {
assert(Raw->Kind == SyntaxKind::DeclModifier);
assert(Raw->Layout.size() == 4);
syntax_assert_child_token(Raw, DeclModifierSyntax::Cursor::Name,
tok::identifier);
#ifndef NDEBUG
auto Name =
cast<TokenSyntax>(Raw->getChild(DeclModifierSyntax::Cursor::Name));
auto Kind = Name->getTokenKind();
assert(Kind == tok::kw_class ||
Kind == tok::kw_static ||
Kind == tok::identifier ||
Kind == tok::kw_public ||
Kind == tok::kw_private ||
Kind == tok::kw_fileprivate ||
Kind == tok::kw_internal);
#endif
syntax_assert_child_token_text(Raw, DeclModifierSyntax::Cursor::LeftParen,
tok::l_paren, "(");
syntax_assert_child_token(Raw, DeclModifierSyntax::Cursor::Argument,