* check if a colon is a class initializer separator * * @return whether it is a class initializer separator */
| 3089 | * @return whether it is a class initializer separator |
| 3090 | */ |
| 3091 | bool ASFormatter::isClassInitializer() const |
| 3092 | { |
| 3093 | assert(currentChar == ':'); |
| 3094 | assert(previousChar != ':' && peekNextChar() != ':'); // not part of '::' |
| 3095 | |
| 3096 | // this should be similar to ASBeautifier::parseCurrentLine() |
| 3097 | bool foundClassInitializer = false; |
| 3098 | |
| 3099 | if (foundQuestionMark) |
| 3100 | { |
| 3101 | // do nothing special |
| 3102 | } |
| 3103 | else if (parenStack->back() > 0) |
| 3104 | { |
| 3105 | // found a 'for' loop or an objective-C statement |
| 3106 | // so do nothing special |
| 3107 | } |
| 3108 | else if (isInEnum) |
| 3109 | { |
| 3110 | // found an enum with a base-type |
| 3111 | } |
| 3112 | else if (isCStyle() |
| 3113 | && !isInCase |
| 3114 | && (previousCommandChar == ')' || foundPreCommandHeader)) |
| 3115 | { |
| 3116 | // found a 'class' c'tor initializer |
| 3117 | foundClassInitializer = true; |
| 3118 | } |
| 3119 | return foundClassInitializer; |
| 3120 | } |
| 3121 | |
| 3122 | /** |
| 3123 | * check if a line is empty |