MCPcopy Create free account
hub / github.com/ZDoom/gzdoom / CheckForDefault

Function CheckForDefault

src/scripting/backend/codegen_doom.cpp:181–211  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

179//==========================================================================
180
181static 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
213static FxExpression* CheckForLineSpecial(FxIdentifier* func, FCompileContext& ctx)
214{

Callers

nothing calls this directly

Calls 3

isActorFunction · 0.85
MessageMethod · 0.80
ResolveMethod · 0.45

Tested by

no test coverage detected