File tree Expand file tree Collapse file tree 2 files changed +20
-3
lines changed
godot_dart/lib/src/annotations Expand file tree Collapse file tree 2 files changed +20
-3
lines changed Original file line number Diff line number Diff line change @@ -21,12 +21,21 @@ class GodotExport {
21
21
const GodotExport ({this .name});
22
22
}
23
23
24
+ @immutable
25
+ class SignalArgument {
26
+ final String name;
27
+ final Type type;
28
+
29
+ const SignalArgument (this .name, this .type);
30
+ }
31
+
24
32
/// Annotate a Godot Signal
25
33
@immutable
26
34
class GodotSignal {
27
35
final String signalName;
36
+ final List <SignalArgument > args;
28
37
29
- const GodotSignal (this .signalName);
38
+ const GodotSignal (this .signalName, { this .args = const []} );
30
39
}
31
40
32
41
/// Annotate a field that should be visible to the Godot property inspector
Original file line number Diff line number Diff line change @@ -155,8 +155,16 @@ class GodotScriptAnnotationGenerator
155
155
final signalName = reader.read ('signalName' ).stringValue;
156
156
buffer.writeln (' name: \' $signalName \' ,' );
157
157
158
- // TODO: Signals that take parameters....
159
- buffer.writeln (' args: [],' );
158
+ final signalArguments = reader.read ('args' ).listValue;
159
+ buffer.writeln (' args: [' );
160
+ for (final arg in signalArguments) {
161
+ final argReader = ConstantReader (arg);
162
+ final argName = argReader.read ('name' ).stringValue;
163
+ final argType = argReader.read ('type' ).typeValue;
164
+ buffer.writeln (
165
+ ' PropertyInfo(name: \' ${argName }\' , typeInfo: ${_typeInfoForType (argType )}),' );
166
+ }
167
+ buffer.writeln (']' );
160
168
buffer.write (')' );
161
169
162
170
return buffer.toString ();
You can’t perform that action at this time.
0 commit comments