private Type parseFunctionOrMethodType(boolean isFunction, EnclosingScope scope) {
		int start = index;
		Tuple<Identifier> lifetimes;
		Tuple<Identifier> captures;
		if (isFunction) {
			match(Function);
			captures = new Tuple<>();
			lifetimes = new Tuple<>();
		} else {
			match(Method);
			captures = parseOptionalCapturedLifetimes(scope);
			scope = scope.newEnclosingScope();
			lifetimes = parseOptionalLifetimeParameters(scope);
		}
		// First, parse the parameter type(s).
		Tuple<Type> paramTypes = parseParameterTypes(scope);
		Tuple<Type> returnTypes = new Tuple<>();
		// Second, parse the right arrow.
		if (isFunction) {
			// Functions require a return type (since otherwise they are just
			// nops)
			match(MinusGreater);
			// Third, parse the return types.
			returnTypes = parseOptionalParameterTypes(scope);
		} else if (tryAndMatch(true, MinusGreater) != null) {
			// Methods have an optional return type
			// Third, parse the return type
			returnTypes = parseOptionalParameterTypes(scope);
		}

		// Done
		Type type;
		if (isFunction) {
			type = new Type.Function(paramTypes, returnTypes);
		} else {
			type = new Type.Method(paramTypes, returnTypes, captures, lifetimes);
		}
		return annotateSourceLocation(type,start);
	}
private Type parseFunctionOrMethodType ( boolean isFunction , EnclosingScope scope ) { int start = index ; Tuple < Identifier > lifetimes ; Tuple < Identifier > captures ; if ( isFunction ) { match ( Function ) ; captures = new Tuple < > ( ) ; lifetimes = new Tuple < > ( ) ; } else { match ( Method ) ; captures = parseOptionalCapturedLifetimes ( scope ) ; scope = scope . newEnclosingScope ( ) ; lifetimes = parseOptionalLifetimeParameters ( scope ) ; } Tuple < Type > paramTypes = parseParameterTypes ( scope ) ; Tuple < Type > returnTypes = new Tuple < > ( ) ; if ( isFunction ) { match ( MinusGreater ) ; returnTypes = parseOptionalParameterTypes ( scope ) ; } else if ( tryAndMatch ( true , MinusGreater ) != null ) { returnTypes = parseOptionalParameterTypes ( scope ) ; } Type type ; if ( isFunction ) { type = new Type . Function ( paramTypes , returnTypes ) ; } else { type = new Type . Method ( paramTypes , returnTypes , captures , lifetimes ) ; } return annotateSourceLocation ( type , start ) ; }
Parse a function or method type, which is of the form:

<pre>
FunctionType ::= "function" [Type (',' Type)* ] "->" Type
MethodType   ::= "method" [Type (',' Type)* ] "->" Type
</pre>

At the moment, it is required that parameters for a function or method
type are enclosed in braces. In principle, we would like to relax this.
However, this is difficult to make work because there is not way to
invoke a function or method without using braces.

@return