| 179 | //========================================================================== |
| 180 | |
| 181 | static FxExpression* CheckForDefault(FxIdentifier* func, FCompileContext& ctx) |
| 182 | { |
| 183 | auto& ScriptPosition = func->ScriptPosition; |
| 184 | |
| 185 | if (func->Identifier == NAME_Default) |
| 186 | { |
| 187 | if (ctx.Function == nullptr) |
| 188 | { |
| 189 | ScriptPosition.Message(MSG_ERROR, "Unable to access class defaults from constant declaration"); |
| 190 | delete func; |
| 191 | return nullptr; |
| 192 | } |
| 193 | if (ctx.Function->Variants[0].SelfClass == nullptr) |
| 194 | { |
| 195 | ScriptPosition.Message(MSG_ERROR, "Unable to access class defaults from static function"); |
| 196 | delete func; |
| 197 | return nullptr; |
| 198 | } |
| 199 | if (!isActor(ctx.Function->Variants[0].SelfClass)) |
| 200 | { |
| 201 | ScriptPosition.Message(MSG_ERROR, "'Default' requires an actor type."); |
| 202 | delete func; |
| 203 | return nullptr; |
| 204 | } |
| 205 | |
| 206 | FxExpression* x = new FxClassDefaults(new FxSelf(ScriptPosition), ScriptPosition); |
| 207 | delete func; |
| 208 | return x->Resolve(ctx); |
| 209 | } |
| 210 | return func; |
| 211 | } |
| 212 | |
| 213 | static FxExpression* CheckForLineSpecial(FxIdentifier* func, FCompileContext& ctx) |
| 214 | { |