parseFunction method
Implementation
FunctionNode parseFunction({bool inObject=false, Token? nameTok=null}) {
int start = !inObject ? token?.startOffset?? 0 : nameTok?.startOffset?? 0;
Token? funToken;
if( !inObject ) {
assert(token?.text == 'function');
funToken = next();
}
//Name name = Name('');
Name? name;
if( token?.type == Token.BINARY ) {
consume(Token.BINARY);
}
if( token?.type == Token.NAME ) {
name = parseName();
// } else if( token?.type == Token.NAME || inObject) {
// name = !inObject ? parseName() : makeName(nameTok);
}
List<Name> params = parseParameters();
BlockStatement body = parseFunctionBody();
return new FunctionNode(name, params, body)
..start = start
..end = endOffset
..line = nameTok?.line?? funToken?.line?? 0
..endLine = body.endLine;
}