%%%
 %% Intertype Member Declarations
 %%
 %% @author  Martin Bravenboer <martin.bravenboer@gmail.com>
 %%%
module languages/aspectj/aspect/IntertypeMemberDeclaration[Ctx]
exports
  sorts IntertypeMemberDec

  %%%
   %% Intertype method declaration
   %%%
  context-free syntax
    IntertypeMethodDecHead MethodBody[[Ctx]] -> IntertypeMemberDec {cons("IntertypeMethodDec")}

    (Anno[[Ctx]] | MethodMod[[Ctx]])* TypeParams[[Ctx]]? ResultType[[Ctx]]
      TypeName[[Ctx]] TypeParams[[Ctx]]? "." Id[[Ctx]] "(" {FormalParam[[Ctx]] ","}* ")" Throws[[Ctx]]?
      -> IntertypeMethodDecHead {cons("IntertypeMethodDecHead")}

  %%%
   %% Intertype constructor declaration
   %%%
  context-free syntax
    IntertypeConstrDecHead ConstrBody[[Ctx]] -> IntertypeMemberDec {cons("IntertypeConstrDec")}

    (Anno[[Ctx]] | ConstrMod[[Ctx]])* TypeParams[[Ctx]]?
      TypeName[[Ctx]] TypeParams[[Ctx]]? "."
      "new" "(" {FormalParam[[Ctx]] ","}* ")" Throws[[Ctx]]?
      -> IntertypeConstrDecHead {cons("IntertypeConstrDecHead")}

  %%%
   %% Intertype field declaration
   %%
   %% @todo This will allow dimensions after the identifier, which is not
   %%        supported by AspectJ.
   %%%
  context-free syntax
    (Anno[[Ctx]] | FieldMod[[Ctx]])* Type[[Ctx]] TypeName[[Ctx]] TypeParams[[Ctx]]? "." VarDec[[Ctx]] ";"
      -> IntertypeMemberDec {cons("IntertypeFieldDec")}