} finally {
inFunction = wasInFunction;
}
FunctionBody body = node.getBody();
FunctionElementImpl element = new FunctionElementImpl(node.getBeginToken().getOffset());
element.setFunctions(holder.getFunctions());
element.setLabels(holder.getLabels());
element.setLocalVariables(holder.getLocalVariables());
element.setParameters(holder.getParameters());
if (body.isAsynchronous()) {
element.setAsynchronous(true);
}
if (body.isGenerator()) {
element.setGenerator(true);
}
if (inFunction) {
Block enclosingBlock = node.getAncestor(Block.class);
if (enclosingBlock != null) {
int functionEnd = node.getOffset() + node.getLength();
int blockEnd = enclosingBlock.getOffset() + enclosingBlock.getLength();
element.setVisibleRange(functionEnd, blockEnd - functionEnd - 1);
}
}
FunctionTypeImpl type = new FunctionTypeImpl(element);
if (functionTypesToFix != null) {
functionTypesToFix.add(type);
}
element.setType(type);
currentHolder.addFunction(element);
node.setElement(element);
holder.validate();
return null;