@@ -7276,22 +7276,13 @@ class OperatorDecl : public Decl {
72767276
72777277 Identifier name;
72787278
7279- ArrayRef<Located<Identifier>> Identifiers;
7280- ArrayRef<NominalTypeDecl *> DesignatedNominalTypes;
72817279 SourceLoc getLocFromSource () const { return NameLoc; }
72827280 friend class Decl ;
72837281public:
72847282 OperatorDecl (DeclKind kind, DeclContext *DC, SourceLoc OperatorLoc,
7285- Identifier Name, SourceLoc NameLoc,
7286- ArrayRef<Located<Identifier>> Identifiers)
7287- : Decl(kind, DC), OperatorLoc(OperatorLoc), NameLoc(NameLoc), name(Name),
7288- Identifiers (Identifiers) {}
7289-
7290- OperatorDecl (DeclKind kind, DeclContext *DC, SourceLoc OperatorLoc,
7291- Identifier Name, SourceLoc NameLoc,
7292- ArrayRef<NominalTypeDecl *> DesignatedNominalTypes)
7293- : Decl(kind, DC), OperatorLoc(OperatorLoc), NameLoc(NameLoc), name(Name),
7294- DesignatedNominalTypes(DesignatedNominalTypes) {}
7283+ Identifier Name, SourceLoc NameLoc)
7284+ : Decl(kind, DC), OperatorLoc(OperatorLoc), NameLoc(NameLoc), name(Name)
7285+ {}
72957286
72967287 // / Retrieve the operator's fixity, corresponding to the concrete subclass
72977288 // / of the OperatorDecl.
@@ -7318,25 +7309,6 @@ class OperatorDecl : public Decl {
73187309 // OperatorDecls.
73197310 DeclBaseName getBaseName () const { return name; }
73207311
7321- // / Get the list of identifiers after the colon in the operator declaration.
7322- // /
7323- // / This list includes the names of designated types. For infix operators, the
7324- // / first item in the list is a precedence group instead.
7325- // /
7326- // / \todo These two purposes really ought to be in separate properties and the
7327- // / designated type list should be of TypeReprs instead of Identifiers.
7328- ArrayRef<Located<Identifier>> getIdentifiers () const {
7329- return Identifiers;
7330- }
7331-
7332- ArrayRef<NominalTypeDecl *> getDesignatedNominalTypes () const {
7333- return DesignatedNominalTypes;
7334- }
7335-
7336- void setDesignatedNominalTypes (ArrayRef<NominalTypeDecl *> nominalTypes) {
7337- DesignatedNominalTypes = nominalTypes;
7338- }
7339-
73407312 static bool classof (const Decl *D) {
73417313 // Workaround: http://llvm.org/PR35906
73427314 if (DeclKind::Last_Decl == DeclKind::Last_OperatorDecl)
@@ -7352,22 +7324,23 @@ class OperatorDecl : public Decl {
73527324// / infix operator /+/ : AdditionPrecedence, Numeric
73537325// / \endcode
73547326class InfixOperatorDecl : public OperatorDecl {
7355- SourceLoc ColonLoc;
7327+ SourceLoc ColonLoc, PrecedenceGroupLoc;
7328+ Identifier PrecedenceGroupName;
73567329
73577330public:
73587331 InfixOperatorDecl (DeclContext *DC, SourceLoc operatorLoc, Identifier name,
73597332 SourceLoc nameLoc, SourceLoc colonLoc,
7360- ArrayRef<Located<Identifier>> identifiers)
7361- : OperatorDecl(DeclKind::InfixOperator, DC, operatorLoc, name, nameLoc,
7362- identifiers),
7363- ColonLoc (colonLoc) {}
7333+ Identifier precedenceGroupName,
7334+ SourceLoc precedenceGroupLoc)
7335+ : OperatorDecl(DeclKind::InfixOperator, DC, operatorLoc, name, nameLoc),
7336+ ColonLoc (colonLoc), PrecedenceGroupLoc(precedenceGroupLoc),
7337+ PrecedenceGroupName(precedenceGroupName) {}
73647338
73657339 SourceLoc getEndLoc () const {
7366- auto identifiers = getIdentifiers ();
7367- if (identifiers.empty ())
7368- return getNameLoc ();
7340+ if (getPrecedenceGroupLoc ().isValid ())
7341+ return getPrecedenceGroupLoc ();
73697342
7370- return identifiers. back (). Loc ;
7343+ return getNameLoc () ;
73717344 }
73727345
73737346 SourceRange getSourceRange () const {
@@ -7376,6 +7349,8 @@ class InfixOperatorDecl : public OperatorDecl {
73767349
73777350 SourceLoc getColonLoc () const { return ColonLoc; }
73787351
7352+ Identifier getPrecedenceGroupName () const { return PrecedenceGroupName; }
7353+ SourceLoc getPrecedenceGroupLoc () const { return PrecedenceGroupLoc; }
73797354 PrecedenceGroupDecl *getPrecedenceGroup () const ;
73807355
73817356 static bool classof (const Decl *D) {
@@ -7391,16 +7366,9 @@ class InfixOperatorDecl : public OperatorDecl {
73917366class PrefixOperatorDecl : public OperatorDecl {
73927367public:
73937368 PrefixOperatorDecl (DeclContext *DC, SourceLoc OperatorLoc, Identifier Name,
7394- SourceLoc NameLoc,
7395- ArrayRef<Located<Identifier>> Identifiers)
7396- : OperatorDecl(DeclKind::PrefixOperator, DC, OperatorLoc, Name, NameLoc,
7397- Identifiers) {}
7398-
7399- PrefixOperatorDecl (DeclContext *DC, SourceLoc OperatorLoc, Identifier Name,
7400- SourceLoc NameLoc,
7401- ArrayRef<NominalTypeDecl *> designatedNominalTypes)
7402- : OperatorDecl(DeclKind::PrefixOperator, DC, OperatorLoc, Name, NameLoc,
7403- designatedNominalTypes) {}
7369+ SourceLoc NameLoc)
7370+ : OperatorDecl(DeclKind::PrefixOperator, DC, OperatorLoc, Name, NameLoc)
7371+ {}
74047372
74057373 SourceRange getSourceRange () const {
74067374 return { getOperatorLoc (), getNameLoc () };
@@ -7419,16 +7387,9 @@ class PrefixOperatorDecl : public OperatorDecl {
74197387class PostfixOperatorDecl : public OperatorDecl {
74207388public:
74217389 PostfixOperatorDecl (DeclContext *DC, SourceLoc OperatorLoc, Identifier Name,
7422- SourceLoc NameLoc,
7423- ArrayRef<Located<Identifier>> Identifiers)
7424- : OperatorDecl(DeclKind::PostfixOperator, DC, OperatorLoc, Name, NameLoc,
7425- Identifiers) {}
7426-
7427- PostfixOperatorDecl (DeclContext *DC, SourceLoc OperatorLoc, Identifier Name,
7428- SourceLoc NameLoc,
7429- ArrayRef<NominalTypeDecl *> designatedNominalTypes)
7430- : OperatorDecl(DeclKind::PostfixOperator, DC, OperatorLoc, Name, NameLoc,
7431- designatedNominalTypes) {}
7390+ SourceLoc NameLoc)
7391+ : OperatorDecl(DeclKind::PostfixOperator, DC, OperatorLoc, Name, NameLoc)
7392+ {}
74327393
74337394 SourceRange getSourceRange () const {
74347395 return { getOperatorLoc (), getNameLoc () };
0 commit comments