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:
@@ -345,6 +345,9 @@ bool ValueDecl::isDefinition() const {
|
||||
case DeclKind::TopLevelCode:
|
||||
case DeclKind::Constructor:
|
||||
case DeclKind::Destructor:
|
||||
case DeclKind::InfixOperator:
|
||||
case DeclKind::PrefixOperator:
|
||||
case DeclKind::PostfixOperator:
|
||||
llvm_unreachable("non-value decls shouldn't get here");
|
||||
|
||||
case DeclKind::Func:
|
||||
@@ -371,6 +374,9 @@ bool ValueDecl::isInstanceMember() const {
|
||||
case DeclKind::Extension:
|
||||
case DeclKind::PatternBinding:
|
||||
case DeclKind::TopLevelCode:
|
||||
case DeclKind::InfixOperator:
|
||||
case DeclKind::PrefixOperator:
|
||||
case DeclKind::PostfixOperator:
|
||||
llvm_unreachable("Not a ValueDecl");
|
||||
|
||||
case DeclKind::Class:
|
||||
|
||||
Reference in New Issue
Block a user