T node, Throwable e) {
if (e instanceof OutOfMemoryError) {
// Always rethrow OOMs (might have no memory to load ICE class anyway).
throw (OutOfMemoryError) e;
}
InternalCompilerException ice;
if (e instanceof InternalCompilerException) {
ice = (InternalCompilerException) e;
} else {
ice = new InternalCompilerException("Unexpected error during visit.", e);
}
ice.addNode((HasSourceInfo) node);
return ice;
}