calculate type name based on Node hierarchy (ignoring anonymous classes)