Skip to content

Commit a1cfd4c

Browse files
piierthoCedNaru
authored andcommitted
fix: replace $ in typenames in classgraph symbol processor (#879)
1 parent 0132cfb commit a1cfd4c

File tree

7 files changed

+14
-151
lines changed

7 files changed

+14
-151
lines changed

harness/tests/src/main/kotlin/godot/tests/constructor/ConstructorRegistrationTest.kt

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,14 @@ package godot.tests.constructor
22

33
import godot.api.Node
44
import godot.annotation.RegisterClass
5+
import godot.annotation.RegisterProperty
56

67
@RegisterClass
7-
class ConstructorRegistrationTest(): Node()
8+
class ConstructorRegistrationTest(): Node() {
9+
@RegisterProperty
10+
var defaultConstructorHasBeenCalled = false
11+
12+
init {
13+
defaultConstructorHasBeenCalled = true
14+
}
15+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
uid://bqpi0f06bv3xl

harness/tests/test/unit/test_constructor_args.gd

Lines changed: 0 additions & 96 deletions
This file was deleted.

harness/tests/test/unit/test_constructor_args.gd.uid

Lines changed: 0 additions & 1 deletion
This file was deleted.

harness/tests/test/unit/test_constructors.gd

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,6 @@ extends "res://addons/gut/test.gd"
22

33

44
func test_should_call_default_constructor() -> void:
5-
var test_instance = MultiArgsConstructorTest.new()
6-
assert_true(test_instance.default_constructor_has_been_called, "Default constructor should have been called")
7-
test_instance.free()
8-
9-
func test_should_call_one_arg_constructor() -> void:
10-
var test_instance = load("res://scripts/godot/tests/MultiArgsConstructorTest.gdj").new(42)
11-
assert_true(test_instance.one_arg_constructor_has_been_called, "One arg constructor should have been called")
12-
test_instance.free()
13-
14-
func test_should_call_three_args_constructor() -> void:
15-
var test_instance = load("res://scripts/godot/tests/MultiArgsConstructorTest.gdj").new(42, "hello")
16-
assert_true(test_instance.three_args_constructor_has_been_called, "Three args constructor should have been called")
17-
test_instance.free()
5+
var test_instance = ConstructorRegistrationTest.new()
6+
assert_true(test_instance.default_constructor_has_been_called, "Default constructor should have been called")
7+
test_instance.free()

kt/entry-generation/godot-class-graph-symbol-processor/src/main/kotlin/godot/annotation/processor/classgraph/extensions/ClassExtentions.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ internal fun ClassInfo.mapToType(typeArguments: List<TypeArgument>, settings: Se
166166
.toList()
167167

168168
return Type(
169-
fqName = name,
169+
fqName = name.replace("$", "."),
170170
kind = typeKind,
171171
supertypes = superTypes,
172172
arguments = { typeArguments.map { it.getType(settings) } },

kt/godot-library/godot-core-library/src/main/kotlin/godot/registration/Registration.kt

Lines changed: 0 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -146,45 +146,6 @@ class ClassBuilderDsl<T : KtObject>(
146146
)
147147
}
148148

149-
inline fun <reified P : Enum<P>> enumProperty(
150-
name: String,
151-
noinline getter: (T) -> P,
152-
noinline setter: (T, P) -> Unit,
153-
usage: Long,
154-
hintString: String
155-
) {
156-
require(!properties.contains(name)) {
157-
"Found two properties with name $name for class $registeredName"
158-
}
159-
160-
properties[name] = KtEnumProperty(
161-
KtPropertyInfo(
162-
VariantParser.LONG,
163-
name,
164-
"Int",
165-
PropertyHint.ENUM,
166-
hintString,
167-
usage,
168-
),
169-
getter,
170-
setter,
171-
{ enum: P? -> enum?.ordinal ?: 1 },
172-
{ i -> enumValues<P>()[i] }
173-
)
174-
}
175-
176-
inline fun <reified P : Enum<P>> enumProperty(
177-
kProperty: KMutableProperty1<T, P>,
178-
usage: Long,
179-
hintString: String
180-
) = enumProperty(
181-
kProperty.name.convertToSnakeCase(),
182-
{ instance: T -> kProperty.get(instance) },
183-
{ instance: T, p: P -> kProperty.set(instance, p) },
184-
usage,
185-
hintString
186-
)
187-
188149
inline fun <reified P : Enum<P>, L : Collection<P>> enumListProperty(
189150
name: String,
190151
noinline getter: (T) -> L,

0 commit comments

Comments
 (0)