LNode MethodArgListAndBody(int startIndex, int targetIndex, VList<LNode> attrs, Symbol kind, LNode type, LNode name)
{
TokenType la0;
Token lit_colon = default(Token);
var lp = Match((int) TT.LParen);
var rp = Match((int) TT.RParen);
WhereClausesOpt(ref name);
// line 1686
LNode r, _, baseCall = null;
// line 1686
int consCallIndex = -1;
// Line 1687: (TT.Colon (TT.Base|TT.This) TT.LParen TT.RParen)?
la0 = LA0;
if (la0 == TT.Colon) {
lit_colon = MatchAny();
var target = Match((int) TT.Base, (int) TT.This);
var baselp = Match((int) TT.LParen);
var baserp = Match((int) TT.RParen);
// line 1689
baseCall = F.Call((Symbol) target.Value, ExprListInside(baselp), target.StartIndex, baserp.EndIndex, target.StartIndex, target.EndIndex);
if ((kind != S.Constructor)) {
Error(baseCall, "This is not a constructor declaration, so there should be no ':' clause.");
}
consCallIndex = lit_colon.StartIndex;
}
// line 1697
for (int i = 0; i < attrs.Count; i++) {
var attr = attrs[i];
if (IsNamedArg(attr) && attr.Args[0].IsIdNamed(S.Return)) {
type = type.PlusAttr(attr.Args[1]);
attrs.RemoveAt(i);
i--;
}
}
// Line 1706: (default TT.Semicolon | MethodBodyOrForward)
do {
switch (LA0) {
case TT.Semicolon:
goto match1;
case TT.At: case TT.Forward: case TT.LambdaArrow: case TT.LBrace:
{
var body = MethodBodyOrForward(false, out _, false, consCallIndex);
// line 1720
if (kind == S.Delegate) {
Error("A 'delegate' is not expected to have a method body.");
}
if (baseCall != null) {
if ((!body.Calls(S.Braces))) {
body = F.Braces(LNode.List(body), startIndex, body.Range.EndIndex);
}
body = body.WithArgs(body.Args.Insert(0, baseCall));
}
var parts = new VList<LNode> {
type, name, ArgList(lp, rp), body
};
r = F.Call(kind, parts, startIndex, body.Range.EndIndex, targetIndex, targetIndex);
}
break;
default:
goto match1;
}
break;
match1:
{
var end = Match((int) TT.Semicolon);
// line 1708
if (kind == S.Constructor && baseCall != null) {
Error(baseCall, "A method body is required.");
var parts = LNode.List(type, name, ArgList(lp, rp), LNode.Call(S.Braces, new VList<LNode>(baseCall), baseCall.Range));
r = F.Call(kind, parts, startIndex, baseCall.Range.EndIndex, targetIndex, targetIndex);
} else {
var parts = LNode.List(type, name, ArgList(lp, rp));
r = F.Call(kind, parts, startIndex, end.EndIndex, targetIndex, targetIndex);
}
}
} while (false);
// line 1731
return r.PlusAttrs(attrs);
}