Skip to content

Commit bdb678c

Browse files
committed
Make use of the new 'abstract' builtin annotation
1 parent 024cf02 commit bdb678c

4 files changed

Lines changed: 16 additions & 12 deletions

File tree

addons/kodot/tools/annotations/annotation.gd

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
@abstract
12
@tool
23
class_name Annotation
34
extends RefCounted
@@ -30,13 +31,13 @@ func find_in_tree(tree: TreeSitterSyntaxTree) -> Array:
3031

3132
## Gets the TreeSitter query which selects this annotation from a GDScript
3233
## syntax tree.
33-
func _get_query_template() -> String:
34-
return Errors.abstract_method("_get_query_template")
34+
@abstract
35+
func _get_query_template() -> String
3536

3637

3738
## Parses annotation-specific metadata from a TreeSitter query match.
38-
func _from_match(query_match: Dictionary) -> Dictionary:
39-
return Errors.abstract_method("_from_match")
39+
@abstract
40+
func _from_match(query_match: Dictionary) -> Dictionary
4041

4142

4243
func _from_match_adding_argument(query_match: Dictionary) -> Dictionary:

addons/kodot/tools/codegen/codegen.gd

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
@abstract
12
@tool
23
class_name Codegen
34
extends RefCounted
@@ -11,14 +12,14 @@ static func _load_template(path: String) -> InjaTemplate:
1112

1213

1314
## Which annotations, if any, are used by this Codegen.
14-
func get_required_annotations() -> Array[Annotation]:
15-
return Errors.abstract_method("get_required_annotations")
15+
@abstract
16+
func get_required_annotations() -> Array[Annotation]
1617

1718

1819
## Generate units of code from the given GDScript resource.
20+
@abstract
1921
func get_codegen_units(
20-
script: GDScript, annotations: Annotations) -> Array[Unit]:
21-
return Errors.abstract_method("get_codegen_units")
22+
script: GDScript, annotations: Annotations) -> Array[Unit]
2223

2324

2425
class Unit:
Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1+
@abstract
12
@tool
23
class_name CodegenWriter
34
extends RefCounted
45

56
## An abstract generated code writer which can, e.g., write to a file.
67

78

8-
func write(new_source: String) -> bool:
9-
return Errors.abstract_method("write")
9+
@abstract
10+
func write(new_source: String) -> bool

addons/kodot/tools/script_processor.gd

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
@abstract
12
@tool
23
class_name ScriptProcessor
34
extends RefCounted
@@ -46,5 +47,5 @@ func apply_to_project() -> void:
4647

4748

4849
## Acts on a single GDSCript source.
49-
func apply_to_script(script: GDScript) -> void:
50-
Errors.abstract_method("apply_to_script")
50+
@abstract
51+
func apply_to_script(script: GDScript) -> void

0 commit comments

Comments
 (0)