Skip to content

Commit 2416273

Browse files
committed
Rename godot_extension: generate_code() -> godot_extension: generate_class_code()
1 parent 0a113b0 commit 2416273

5 files changed

+9
-8
lines changed

scripts/gdextension_cython_preprocessor.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
r"^cdef\s+(inline\s+)?(?P<return_type>\w+((\s*\*\s*)|(\s+)))(?P<method_name>\w+)\((?P<parameters>.*)\):"
1212
)
1313

14-
INJECT_CODE_PRAGMA = "generate_code()"
14+
INJECT_CLASS_CODE_PRAGMA = "generate_class_code()"
1515
INJECT_MODULE_CODE_PRAGMA = "generate_module_code()"
1616
AUTOGENERATED_HEADER = "*** Start of auto-generated code ***"
1717
AUTOGENERATED_FOOTER = "*** End of auto-generated code ***"
@@ -248,7 +248,7 @@ def extract_classes_from_code(raw_code_lines: list[str]) -> ModuleDef:
248248
continue
249249

250250
pragma = match.group("pragma").strip()
251-
if pragma == INJECT_CODE_PRAGMA:
251+
if pragma == INJECT_CLASS_CODE_PRAGMA:
252252
if current_class is None:
253253
raise RuntimeError(
254254
f"Line {i + 1}: `# godot_extension: {pragma}` must be within a `# godot_extension: class(...)` pragma"
@@ -530,11 +530,11 @@ def _class(
530530
for klass in classes:
531531
if klass.inject_code_at_line == -1:
532532
raise RuntimeError(
533-
f"Line {klass.class_def_at_line}: Missing pragam `# godot_extension: {INJECT_CODE_PRAGMA}` for class `{klass.class_name}`"
533+
f"Line {klass.class_def_at_line}: Missing pragam `# godot_extension: {INJECT_CLASS_CODE_PRAGMA}` for class `{klass.class_name}`"
534534
)
535535
if inject_module_code_at_line == -1:
536536
raise RuntimeError(
537-
f"A `# godot_extension: {INJECT_MODULE_CODE_PRAGMA}` must be defined at module level to be able to use `# godot_extension: {INJECT_CODE_PRAGMA}`"
537+
f"A `# godot_extension: {INJECT_MODULE_CODE_PRAGMA}` must be defined at module level to be able to use `# godot_extension: {INJECT_CLASS_CODE_PRAGMA}`"
538538
)
539539

540540
return ModuleDef(

src/_pythonscript_extension_class_language.pxi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -531,6 +531,6 @@ class {py_class_name}({py_base_class_name}):
531531
gd_string_del(&path)
532532
return ret
533533

534-
# godot_extension: generate_code()
534+
# godot_extension: generate_class_code()
535535

536536
# godot_extension: generate_module_code()

src/_pythonscript_extension_class_script.pxi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,6 @@ cdef class PythonScript:
270270
# For now, just acknowledge the call
271271
pass
272272

273-
# godot_extension: generate_code()
273+
# godot_extension: generate_class_code()
274274

275275
# godot_extension: generate_module_code()

src/_pythonscript_extension_resource_format_loader.pxi

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@ cdef class PythonResourceFormatLoader:
132132

133133
# Don't overload `_recognize_path()`, so Godot instead relies on `_get_recognized_extensions()` & `_get_resource_type()`
134134

135-
# godot_extension: generate_code()
135+
# godot_extension: generate_class_code()
136+
136137

137138
# godot_extension: generate_module_code()

src/_pythonscript_extension_resource_format_saver.pxi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,6 @@ cdef class PythonResourceFormatSaver:
8080

8181
# Don't overload `_set_uid()` to mimic GDScript
8282

83-
# godot_extension: generate_code()
83+
# godot_extension: generate_class_code()
8484

8585
# godot_extension: generate_module_code()

0 commit comments

Comments
 (0)