mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Parser: Parse operator decls.
At the top level, if 'operator' is followed by 'infix', 'prefix', or 'postfix', consider it a contextual keyword, and parse an operator decl following it that looks like:
operator {infix|postfix|prefix} <+> {
attributes…
}
Prefix and postfix operator decls currently admit no attributes. Infix operators have 'associativity {left|right|none}' and 'precedence <int>' attributes.
This patch implements parsing for operator declarations but does not yet attach the declared attributes to func decls for the operators.
Swift SVN r4596
This commit is contained in:
@@ -731,6 +731,9 @@ void IRGenModule::emitClassDecl(ClassDecl *D) {
|
||||
case DeclKind::Protocol:
|
||||
case DeclKind::OneOfElement:
|
||||
case DeclKind::Extension:
|
||||
case DeclKind::InfixOperator:
|
||||
case DeclKind::PrefixOperator:
|
||||
case DeclKind::PostfixOperator:
|
||||
llvm_unreachable("decl not allowed in class!");
|
||||
|
||||
// We can have meaningful initializers for variables, but
|
||||
|
||||
Reference in New Issue
Block a user